1 #include "pthread_impl.h"
5 void pthread_exit(void *result)
8 struct pthread *self = pthread_self();
11 a_dec(&libc.threads_minus_1);
12 if (libc.threads_minus_1 < 0)
15 LOCK(&self->exitlock);
17 if (self->tsd_used) for (i=0; i<PTHREAD_KEYS_MAX; i++)
18 if (self->tsd[i] && libc.tsd_keys[i])
19 libc.tsd_keys[i](self->tsd[i]);
21 if (self->detached && self->map_base)
22 __unmapself(self->map_base, self->map_size);