int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
int pthread_detach(pthread_t);
+#ifdef __wasilibc_unmodified_upstream
_Noreturn void pthread_exit(void *);
+#endif
int pthread_join(pthread_t, void **);
#ifdef __GNUC__
hidden void __pthread_testcancel(void);
hidden int __pthread_setcancelstate(int, int *);
hidden int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict);
+#ifdef __wasilibc_unmodified_upstream
hidden _Noreturn void __pthread_exit(void *);
+#endif
hidden int __pthread_join(pthread_t, void **);
hidden int __pthread_mutex_lock(pthread_mutex_t *);
hidden int __pthread_mutex_trylock(pthread_mutex_t *);
if (tl_lock_waiters) __wake(&__thread_list_lock, 1, 0);
}
+#ifdef __wasilibc_unmodified_upstream
_Noreturn void __pthread_exit(void *result)
+#else
+static void __pthread_exit(void *result)
+#endif
{
pthread_t self = __pthread_self();
sigset_t set;
__tl_unlock();
free(self->map_base);
// Can't use `exit()` here, because it is too high level
- for (;;) __wasi_proc_exit(0);
+ return;
}
#endif
// do it manually here
__tl_unlock();
// Can't use `exit()` here, because it is too high level
- for (;;) __wasi_proc_exit(0);
#endif
}
}
#else
__attribute__((export_name("wasi_thread_start")))
-_Noreturn void wasi_thread_start(int tid, void *p)
+void wasi_thread_start(int tid, void *p)
{
struct start_args *args = p;
__asm__(".globaltype __tls_base, i32\n"
return EAGAIN;
}
+#ifdef __wasilibc_unmodified_upstream
weak_alias(__pthread_exit, pthread_exit);
+#endif
weak_alias(__pthread_create, pthread_create);