pthread_once: fix mutex_unlock to allow recursion Unlock the __once_mutex before calling the specified function to avoid deadlock on recursive calls, as apparently can happen in the C++ STL. Fix from Robert David <davidrob@fit.cvut.cz>.
diff --git a/pthread.c b/pthread.c index 8310595..bfca88c 100644 --- a/pthread.c +++ b/pthread.c
@@ -716,8 +716,8 @@ return 0; } *once = PTHREAD_ONCE_INIT+1; - init(); pthread_mutex_unlock(&__once_mutex); + init(); return 0; }