From: Martin Willi Date: Wed, 15 Apr 2015 08:53:27 +0000 (+0200) Subject: thread: Don't acquire lock for thread_cleanup_push/pop X-Git-Tag: 5.3.1dr1~16^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef33f8e85d8e26f1e03a183e340b38af04d47c60;p=thirdparty%2Fstrongswan.git 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. --- 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) {