summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-14 01:25:17 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-14 01:25:17 -0400
commitf58c8a0f391987a65e055ae591ec59b9df7b7f7c (patch)
tree85712f3b6a1175322d335a1e41096c2b467ec8b2
parent6232b96f5153d0b718054a8bc569fcd7d596bab2 (diff)
downloadmusl-f58c8a0f391987a65e055ae591ec59b9df7b7f7c.tar.gz
run dtors before taking the exit-lock in pthread exit
previously a long-running dtor could cause pthread_detach to block.
-rw-r--r--src/thread/pthread_create.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index d1eea0ce..c856c581 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -22,10 +22,10 @@ void __pthread_unwind_next(struct __ptcb *cb)
longjmp((void *)cb->__next->__jb, 1);
}
- __lock(&self->exitlock);
-
__pthread_tsd_run_dtors();
+ __lock(&self->exitlock);
+
/* Mark this thread dead before decrementing count */
self->dead = 1;