X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fthread%2Fpthread_create.c;h=d60c2a4d3b8442f2a2bba1ee3855096b84261e6c;hb=6717e62ac0ebcea681c7db4fafd36d2a0f1d6034;hp=d1eea0cead731d4523d0c09fc114ae91bd27f006;hpb=6232b96f5153d0b718054a8bc569fcd7d596bab2;p=musl diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index d1eea0ce..d60c2a4d 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -22,12 +22,14 @@ 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 */ + __lock(&self->killlock); self->dead = 1; + a_store(&self->killlock, 0); do n = libc.threads_minus_1; while (n && a_cas(&libc.threads_minus_1, n, n-1)!=n);