File tree Expand file tree Collapse file tree
expected/wasm32-wasi/posix
libc-top-half/musl/src/thread Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
203203 thread/pthread_condattr_init.c \
204204 thread/pthread_condattr_setclock.c \
205205 thread/pthread_condattr_setpshared.c \
206+ thread/pthread_create.c \
206207 thread/pthread_mutex_consistent.c \
207208 thread/pthread_mutex_destroy.c \
208209 thread/pthread_mutex_init.c \
@@ -229,6 +230,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
229230 thread/pthread_rwlockattr_destroy.c \
230231 thread/pthread_rwlockattr_init.c \
231232 thread/pthread_rwlockattr_setpshared.c \
233+ thread/pthread_setcancelstate.c \
232234 thread/pthread_testcancel.c \
233235 thread/sem_destroy.c \
234236 thread/sem_getvalue.c \
@@ -237,7 +239,6 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
237239 thread/sem_timedwait.c \
238240 thread/sem_trywait.c \
239241 thread/sem_wait.c \
240- thread/pthread_setcancelstate.c \
241242 )
242243endif
243244
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ __EINVAL
1111__ENOMEM
1212__SIG_ERR
1313__SIG_IGN
14+ __acquire_ptc
1415__aio_close
1516__asctime_r
1617__assert_fail
@@ -41,6 +42,7 @@ __des_setkey
4142__do_cleanup_pop
4243__do_cleanup_push
4344__do_des
45+ __do_orphaned_stdio_locks
4446__duplocale
4547__env_rm_add
4648__exp2f_data
@@ -182,6 +184,8 @@ __private_cond_signal
182184__progname
183185__progname_full
184186__pthread_cond_timedwait
187+ __pthread_create
188+ __pthread_exit
185189__pthread_mutex_lock
186190__pthread_mutex_timedlock
187191__pthread_mutex_trylock
@@ -196,11 +200,15 @@ __pthread_rwlock_unlock
196200__pthread_rwlock_wrlock
197201__pthread_setcancelstate
198202__pthread_testcancel
203+ __pthread_tsd_main
204+ __pthread_tsd_run_dtors
205+ __pthread_tsd_size
199206__putenv
200207__qsort_r
201208__rand48_step
202209__random_lockptr
203210__reallocarray
211+ __release_ptc
204212__rem_pio2
205213__rem_pio2_large
206214__rem_pio2f
@@ -257,6 +265,9 @@ __tanl
257265__testcancel
258266__timedwait
259267__timedwait_cp
268+ __tl_lock
269+ __tl_sync
270+ __tl_unlock
260271__tm_to_secs
261272__tm_to_tzname
262273__tolower_l
@@ -322,6 +333,7 @@ __wasi_sock_accept
322333__wasi_sock_recv
323334__wasi_sock_send
324335__wasi_sock_shutdown
336+ __wasi_thread_spawn
325337__wasilibc_access
326338__wasilibc_cwd
327339__wasilibc_cwd_lock
@@ -948,6 +960,8 @@ pthread_condattr_destroy
948960pthread_condattr_init
949961pthread_condattr_setclock
950962pthread_condattr_setpshared
963+ pthread_create
964+ pthread_exit
951965pthread_mutex_consistent
952966pthread_mutex_destroy
953967pthread_mutex_getprioceiling
@@ -1212,6 +1226,7 @@ vswprintf
12121226vswscanf
12131227vwprintf
12141228vwscanf
1229+ wasi_thread_start
12151230wcpcpy
12161231wcpncpy
12171232wcrtomb
Original file line number Diff line number Diff line change 11__addtf3
2+ __copy_tls
3+ __default_guardsize
4+ __default_stacksize
25__divtf3
36__eqtf2
47__extenddftf2
@@ -56,6 +59,7 @@ __imported_wasi_snapshot_preview1_sock_accept
5659__imported_wasi_snapshot_preview1_sock_recv
5760__imported_wasi_snapshot_preview1_sock_send
5861__imported_wasi_snapshot_preview1_sock_shutdown
62+ __imported_wasi_snapshot_preview2_thread_spawn
5963__letf2
6064__lock
6165__lockfile
@@ -64,6 +68,7 @@ __main_argc_argv
6468__netf2
6569__stack_pointer
6670__subtf3
71+ __thread_list_lock
6772__tls_base
6873__trunctfdf2
6974__trunctfsf2
Original file line number Diff line number Diff line change @@ -2089,6 +2089,25 @@ __wasi_errno_t __wasi_sock_shutdown(
20892089) __attribute__((__warn_unused_result__ ));
20902090/** @} */
20912091
2092+ #ifdef _REENTRANT
2093+ /**
2094+ * Request a new thread to be created by the host.
2095+ *
2096+ * The host will create a new instance of the current module sharing its
2097+ * memory, find an exported entry function--`wasi_thread_start`--, and call the
2098+ * entry function with `start_arg` in the new thread.
2099+ *
2100+ * @see https://github.com/WebAssembly/wasi-threads/#readme
2101+ */
2102+ __wasi_errno_t __wasi_thread_spawn (
2103+ /**
2104+ * A pointer to an opaque struct to be passed to the module's entry
2105+ * function.
2106+ */
2107+ void * start_arg
2108+ ) __attribute__((__warn_unused_result__ ));
2109+ #endif
2110+
20922111#ifdef __cplusplus
20932112}
20942113#endif
Original file line number Diff line number Diff line change @@ -659,3 +659,14 @@ __wasi_errno_t __wasi_sock_shutdown(
659659 return (uint16_t ) ret ;
660660}
661661
662+ #ifdef _REENTRANT
663+ int32_t __imported_wasi_snapshot_preview2_thread_spawn (int32_t arg0 ) __attribute__((
664+ __import_module__ ("wasi_snapshot_preview2" ),
665+ __import_name__ ("thread_spawn" )
666+ ));
667+
668+ __wasi_errno_t __wasi_thread_spawn (void * start_arg ) {
669+ int32_t ret = __imported_wasi_snapshot_preview2_thread_spawn ((int32_t ) start_arg );
670+ return (uint16_t ) ret ;
671+ }
672+ #endif
You can’t perform that action at this time.
0 commit comments