mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 07:33:08 +00:00
ThreadPool: Make join() a no-op in single-threaded mode
This comptime gate is needed to make sure that purely single-threaded programs don't generate calls to the std.Thread API. WASI targets successfully build again with this change.
This commit is contained in:
parent
62023c60b4
commit
9b05474d79
@ -49,6 +49,10 @@ pub fn deinit(self: *ThreadPool) void {
|
||||
}
|
||||
|
||||
fn join(self: *ThreadPool, spawned: usize) void {
|
||||
if (builtin.single_threaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user