authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-03-13 19:20:18+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-03-13 19:20:18+01:00
log2501e80500f99c1ede6daf2f7c50c2dec3c9675c
treeb98c7584811f2fa5114945d1c520d5444f91ebcb
parente496ef26dabb3a2da4821c7c0c2e4ffc6f7d86ce

Even better idle waiting method


1 files changed, 5 insertions(+), 5 deletions(-)

lib/std/debug.zig+5-5
......@@ -278,11 +278,11 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c
278278 // Another thread is panicking, wait for the last one to finish
279279 // and call abort()
280280
281 // Here we sleep forever without hammering the CPU by causing a
282 // deadlock
283 var deadlock = std.Mutex.init();
284 _ = deadlock.acquire();
285 _ = deadlock.acquire();
281 // Sleep forever without hammering the CPU
282 var event = std.ResetEvent.init();
283 event.wait();
284
285 unreachable;
286286 }
287287 },
288288 1 => {