Fix getCurrentId test for pthreads (#2197)
* Fix getCurrentId test for pthreads
This commit is contained in:
parent
d72239d339
commit
895e6eabc2
@ -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);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user