From ef33f8e85d8e26f1e03a183e340b38af04d47c60 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 15 Apr 2015 10:53:27 +0200 Subject: [PATCH] thread: Don't acquire lock for thread_cleanup_push/pop This is called only by the thread for its own thread_t, and does not need synchronization. --- src/libstrongswan/threading/thread.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libstrongswan/threading/thread.c b/src/libstrongswan/threading/thread.c index 2bf86c1589..91a2d345d4 100644 --- a/src/libstrongswan/threading/thread.c +++ b/src/libstrongswan/threading/thread.c @@ -374,9 +374,7 @@ void thread_cleanup_push(thread_cleanup_t cleanup, void *arg) .arg = arg, ); - this->mutex->lock(this->mutex); this->cleanup_handlers->insert_last(this->cleanup_handlers, handler); - this->mutex->unlock(this->mutex); } /** @@ -387,15 +385,12 @@ void thread_cleanup_pop(bool execute) private_thread_t *this = (private_thread_t*)thread_current(); cleanup_handler_t *handler; - this->mutex->lock(this->mutex); if (this->cleanup_handlers->remove_last(this->cleanup_handlers, (void**)&handler) != SUCCESS) { - this->mutex->unlock(this->mutex); DBG1(DBG_LIB, "!!! THREAD CLEANUP ERROR !!!"); return; } - this->mutex->unlock(this->mutex); if (execute) { -- 2.47.2