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:
Cody Tapscott 2022-06-10 07:21:54 -07:00 committed by Andrew Kelley
parent 62023c60b4
commit 9b05474d79

View File

@ -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();