From cabebe8bc26d7a01f51e8daf9640f038378547f3 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 25 Jun 2017 09:57:00 -0700 Subject: Clear the owner while *still* holding the lock. --- src/platform/posix/posix_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/platform') diff --git a/src/platform/posix/posix_thread.c b/src/platform/posix/posix_thread.c index d3b6c1e1..5abeaded 100644 --- a/src/platform/posix/posix_thread.c +++ b/src/platform/posix/posix_thread.c @@ -89,10 +89,10 @@ nni_plat_mtx_unlock(nni_plat_mtx *mtx) int rv; NNI_ASSERT(mtx->owner == pthread_self()); + mtx->owner = 0; if ((rv = pthread_mutex_unlock(&mtx->mtx)) != 0) { nni_panic("pthread_mutex_unlock: %s", strerror(rv)); } - mtx->owner = 0; } -- cgit v1.2.3-70-g09d2