| ... | @@ -46,13 +46,17 @@ test "std.os.Thread.getCurrentId" { | ... | @@ -46,13 +46,17 @@ test "std.os.Thread.getCurrentId" { |
| 46 | const thread = try os.spawnThread(&thread_current_id, testThreadIdFn); | 46 | const thread = try os.spawnThread(&thread_current_id, testThreadIdFn); |
| 47 | const thread_id = thread.handle(); | 47 | const thread_id = thread.handle(); |
| 48 | thread.wait(); | 48 | thread.wait(); |
| 49 | switch (builtin.os) { | 49 | if (os.Thread.use_pthreads) { |
| 50 | builtin.Os.windows => expect(os.Thread.getCurrentId() != thread_current_id), | 50 | expect(thread_current_id == thread_id); |
| 51 | else => { | 51 | } else { |
| 52 | // If the thread completes very quickly, then thread_id can be 0. See the | 52 | switch (builtin.os) { |
| 53 | // documentation comments for `std.os.Thread.handle`. | 53 | builtin.Os.windows => expect(os.Thread.getCurrentId() != thread_current_id), |
| 54 | expect(thread_id == 0 or thread_current_id == thread_id); | 54 | else => { |
| 55 | }, | 55 | // If the thread completes very quickly, then thread_id can be 0. See the |
| | 56 | // documentation comments for `std.os.Thread.handle`. |
| | 57 | expect(thread_id == 0 or thread_current_id == thread_id); |
| | 58 | }, |
| | 59 | } |
| 56 | } | 60 | } |
| 57 | } | 61 | } |
| 58 | | 62 | |