]> git.proxmox.com Git - wasi-libc.git/commitdiff
threads: enable pthread_join (#336)
authorMarcin Kolny <mkolny@amazon.com>
Mon, 10 Oct 2022 22:25:56 +0000 (23:25 +0100)
committerGitHub <noreply@github.com>
Mon, 10 Oct 2022 22:25:56 +0000 (15:25 -0700)
Makefile
expected/wasm32-wasi/posix/defined-symbols.txt
libc-top-half/musl/src/thread/pthread_join.c

index 9529b0108eb43dd725136e120864ba744b3fa40f..50519fdd423efbf0fe0f1743d3ae61fed40fdab6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
         thread/pthread_condattr_setclock.c \
         thread/pthread_condattr_setpshared.c \
         thread/pthread_create.c \
+        thread/pthread_join.c \
         thread/pthread_mutex_consistent.c \
         thread/pthread_mutex_destroy.c \
         thread/pthread_mutex_init.c \
index b793259576c3b472b3b3347c585a3c7123048c9a..fe29f30b4cf0d8a140fe42af446a6bdc414872c0 100644 (file)
@@ -187,6 +187,7 @@ __progname_full
 __pthread_cond_timedwait
 __pthread_create
 __pthread_exit
+__pthread_join
 __pthread_mutex_lock
 __pthread_mutex_timedlock
 __pthread_mutex_trylock
@@ -964,6 +965,7 @@ pthread_condattr_setclock
 pthread_condattr_setpshared
 pthread_create
 pthread_exit
+pthread_join
 pthread_mutex_consistent
 pthread_mutex_destroy
 pthread_mutex_getprioceiling
@@ -992,6 +994,8 @@ pthread_rwlockattr_init
 pthread_rwlockattr_setpshared
 pthread_setcancelstate
 pthread_testcancel
+pthread_timedjoin_np
+pthread_tryjoin_np
 putc
 putc_unlocked
 putchar
index 17dae85d7086155a78b89052b6f0b551429a2987..b06e7e75ef46c617f082660019b530dfcbfe0cff 100644 (file)
@@ -1,6 +1,8 @@
 #define _GNU_SOURCE
 #include "pthread_impl.h"
+#ifdef __wasilibc_unmodified_upstream
 #include <sys/mman.h>
+#endif
 
 static void dummy1(pthread_t t)
 {
@@ -21,7 +23,11 @@ static int __pthread_timedjoin_np(pthread_t t, void **res, const struct timespec
        if (r == ETIMEDOUT || r == EINVAL) return r;
        __tl_sync(t);
        if (res) *res = t->result;
+#ifdef __wasilibc_unmodified_upstream
        if (t->map_base) __munmap(t->map_base, t->map_size);
+#else
+       if (t->map_base) free(t->map_base);
+#endif
        return 0;
 }