default to single-threaded for WebAssembly
When targeting WebAssembly, we default to building a single-threaded build as threads are still experimental. The user however can enable a multi- threaded build by specifying '-fno-single-threaded'. It's a compile-error to enable this flag, but not also enable shared-memory.
This commit is contained in:
@@ -919,6 +919,10 @@ const WasiThreadImpl = struct {
|
||||
|
||||
/// Bootstrap procedure, called by the host environment after thread creation.
|
||||
export fn wasi_thread_start(tid: i32, arg: *Instance) void {
|
||||
if (builtin.single_threaded) {
|
||||
// ensure function is not analyzed in single-threaded mode
|
||||
return;
|
||||
}
|
||||
__set_stack_pointer(arg.thread.memory.ptr + arg.stack_offset);
|
||||
__wasm_init_tls(arg.thread.memory.ptr + arg.tls_offset);
|
||||
@atomicStore(u32, &WasiThreadImpl.tls_thread_id, @intCast(tid), .SeqCst);
|
||||
|
||||
Reference in New Issue
Block a user