replace armhf math asm source files with inline asm
[musl] / src / thread / pthread_create.c
index 4eb8b88..e7df34a 100644 (file)
@@ -67,12 +67,6 @@ _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);
-       }
-
        /* Process robust list in userspace to handle non-pshared mutexes
         * and the detached thread case where the robust list head will
         * be invalid when the kernel would process it. */
@@ -197,8 +191,9 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
        if (!libc.can_do_threads) return ENOSYS;
        self = __pthread_self();
        if (!libc.threaded) {
-               for (FILE *f=libc.ofl_head; f; f=f->next)
+               for (FILE *f=*__ofl_lock(); f; f=f->next)
                        init_file_lock(f);
+               __ofl_unlock();
                init_file_lock(__stdin_used);
                init_file_lock(__stdout_used);
                init_file_lock(__stderr_used);
@@ -237,7 +232,8 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
                if (guard) {
                        map = __mmap(0, size, PROT_NONE, MAP_PRIVATE|MAP_ANON, -1, 0);
                        if (map == MAP_FAILED) goto fail;
-                       if (__mprotect(map+guard, size-guard, PROT_READ|PROT_WRITE)) {
+                       if (__mprotect(map+guard, size-guard, PROT_READ|PROT_WRITE)
+                           && errno != ENOSYS) {
                                __munmap(map, size);
                                goto fail;
                        }