diff options
Diffstat (limited to 'src/thread')
-rw-r--r-- | src/thread/pthread_create.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |