mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Nicer idle wait loop
Trying to acquire twice the same mutex generates an idle loop.
This commit is contained in:
parent
edcf8e0636
commit
e496ef26da
@ -278,8 +278,11 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c
|
|||||||
// Another thread is panicking, wait for the last one to finish
|
// Another thread is panicking, wait for the last one to finish
|
||||||
// and call abort()
|
// and call abort()
|
||||||
|
|
||||||
// XXX: Find a nicer way to loop forever
|
// Here we sleep forever without hammering the CPU by causing a
|
||||||
while (true) {}
|
// deadlock
|
||||||
|
var deadlock = std.Mutex.init();
|
||||||
|
_ = deadlock.acquire();
|
||||||
|
_ = deadlock.acquire();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user