Commit 895e6eabc2
Changed files (1)
std
os
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);
+ },
+ }
}
}