X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_create.c;h=a7493c1041018e66209818c66ef30b319c89a74a;hb=0bc03091bb674ebb9fa6fe69e4aec1da3ac484f2;hp=e9c8160a4f982b0be2ea4c902810c2350a91902a;hpb=984c25b74da085c6ae6b44a87bbd5f8afc9be331;p=musl diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index e9c8160a..a7493c10 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -57,6 +57,12 @@ _Noreturn void pthread_exit(void *result) exit(0); } + if (self->locale != &libc.global_locale) { + a_dec(&libc.uselocale_cnt); + if (self->locale->ctype_utf8) + a_dec(&libc.bytelocale_cnt_minus_1); + } + if (self->detached && self->map_base) { /* Detached threads must avoid the kernel clear_child_tid * feature, since the virtual address will have been @@ -205,6 +211,7 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attrp new->start_arg = arg; new->self = new; new->tsd = (void *)tsd; + new->locale = &libc.global_locale; if (attr._a_detach) { new->detached = 1; flags -= CLONE_CHILD_CLEARTID;