File tree 5 files changed +18
-2
lines changed
expected/wasm32-wasi-pthread
libc-top-half/musl/src/thread
5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,7 @@ __wasi_sock_accept
354
354
__wasi_sock_recv
355
355
__wasi_sock_send
356
356
__wasi_sock_shutdown
357
+ __wasi_thread_exit
357
358
__wasi_thread_spawn
358
359
__wasilibc_access
359
360
__wasilibc_cwd
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ __imported_wasi_snapshot_preview1_sock_accept
56
56
__imported_wasi_snapshot_preview1_sock_recv
57
57
__imported_wasi_snapshot_preview1_sock_send
58
58
__imported_wasi_snapshot_preview1_sock_shutdown
59
+ __imported_wasi_thread_exit
59
60
__imported_wasi_thread_spawn
60
61
__letf2
61
62
__lttf2
Original file line number Diff line number Diff line change @@ -2106,6 +2106,10 @@ int32_t __wasi_thread_spawn(
2106
2106
*/
2107
2107
void * start_arg
2108
2108
) __attribute__((__warn_unused_result__ ));
2109
+ /**
2110
+ * Terminate the calling thread.
2111
+ */
2112
+ _Noreturn void __wasi_thread_exit (void );
2109
2113
#endif
2110
2114
2111
2115
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -668,4 +668,14 @@ int32_t __imported_wasi_thread_spawn(int32_t arg0) __attribute__((
668
668
int32_t __wasi_thread_spawn (void * start_arg ) {
669
669
return __imported_wasi_thread_spawn ((int32_t ) start_arg );
670
670
}
671
+
672
+ _Noreturn void __imported_wasi_thread_exit (void ) __attribute__((
673
+ __import_module__ ("wasi" ),
674
+ __import_name__ ("thread_exit" )
675
+ ));
676
+
677
+ _Noreturn void __wasi_thread_exit (void )
678
+ {
679
+ __imported_wasi_thread_exit ();
680
+ }
671
681
#endif
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ _Noreturn void __pthread_exit(void *result)
191
191
__tl_unlock ();
192
192
free (self -> map_base );
193
193
// Can't use `exit()` here, because it is too high level
194
- for (;;) __wasi_proc_exit ( 0 );
194
+ for (;;) __wasi_thread_exit ( );
195
195
}
196
196
#endif
197
197
@@ -212,7 +212,7 @@ _Noreturn void __pthread_exit(void *result)
212
212
// do it manually here
213
213
__tl_unlock ();
214
214
// Can't use `exit()` here, because it is too high level
215
- for (;;) __wasi_proc_exit ( 0 );
215
+ for (;;) __wasi_thread_exit ( );
216
216
#endif
217
217
}
218
218
You can’t perform that action at this time.
0 commit comments