diff --git a/std/os/test.zig b/std/os/test.zig index 0f34e5279c..0ee6fc1f26 100644 --- a/std/os/test.zig +++ b/std/os/test.zig @@ -46,13 +46,17 @@ test "std.os.Thread.getCurrentId" { const thread = try os.spawnThread(&thread_current_id, testThreadIdFn); const thread_id = thread.handle(); thread.wait(); - switch (builtin.os) { - builtin.Os.windows => expect(os.Thread.getCurrentId() != thread_current_id), - else => { - // If the thread completes very quickly, then thread_id can be 0. See the - // documentation comments for `std.os.Thread.handle`. - expect(thread_id == 0 or thread_current_id == thread_id); - }, + if (os.Thread.use_pthreads) { + expect(thread_current_id == thread_id); + } else { + switch (builtin.os) { + builtin.Os.windows => expect(os.Thread.getCurrentId() != thread_current_id), + else => { + // If the thread completes very quickly, then thread_id can be 0. See the + // documentation comments for `std.os.Thread.handle`. + expect(thread_id == 0 or thread_current_id == thread_id); + }, + } } }