commit | c4dadb229d762b15fd6c11e38b3142831311d8fb | [log] [tgz] |
---|---|---|
author | Steve Reinhardt <steve.reinhardt@amd.com> | Mon Mar 10 12:29:59 2014 -0700 |
committer | Steve Reinhardt <steve.reinhardt@amd.com> | Mon Mar 10 12:29:59 2014 -0700 |
tree | 8a07feba756068217dea10040bc173c8a1f32d8c | |
parent | 4ee4928e55702358648664cb6671b72b3c17be09 [diff] |
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; }