chor: upgrade to latest zig; remove zg dependency
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 55s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 55s
This commit is contained in:
@@ -215,7 +215,7 @@ fn sleepyPop(q: *Queue(u8, 2)) !void {
|
||||
// still full and the push in the other thread is still blocked
|
||||
// waiting for space.
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s);
|
||||
std.Thread.sleep(std.time.ns_per_s);
|
||||
// Finally, let that other thread go.
|
||||
try testing.expectEqual(1, q.pop());
|
||||
|
||||
@@ -225,7 +225,7 @@ fn sleepyPop(q: *Queue(u8, 2)) !void {
|
||||
try Thread.yield();
|
||||
// But we want to ensure that there's a second push waiting, so
|
||||
// here's another sleep.
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
|
||||
// Another spurious wake...
|
||||
q.not_full.signal();
|
||||
@@ -233,7 +233,7 @@ fn sleepyPop(q: *Queue(u8, 2)) !void {
|
||||
// And another chance for the other thread to see that it's
|
||||
// spurious and go back to sleep.
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
|
||||
// Pop that thing and we're done.
|
||||
try testing.expectEqual(2, q.pop());
|
||||
@@ -270,14 +270,14 @@ test "Fill, block, fill, block" {
|
||||
fn sleepyPush(q: *Queue(u8, 1)) !void {
|
||||
// Try to ensure the other thread has already started trying to pop.
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
|
||||
// Spurious wake
|
||||
q.not_full.signal();
|
||||
q.not_empty.signal();
|
||||
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
|
||||
// Stick something in the queue so it can be popped.
|
||||
q.push(1);
|
||||
@@ -286,7 +286,7 @@ fn sleepyPush(q: *Queue(u8, 1)) !void {
|
||||
try Thread.yield();
|
||||
// Give the other thread time to block again.
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
|
||||
// Spurious wake
|
||||
q.not_full.signal();
|
||||
@@ -317,7 +317,7 @@ test "2 readers" {
|
||||
const t1 = try Thread.spawn(cfg, readerThread, .{&queue});
|
||||
const t2 = try Thread.spawn(cfg, readerThread, .{&queue});
|
||||
try Thread.yield();
|
||||
std.time.sleep(std.time.ns_per_s / 2);
|
||||
std.Thread.sleep(std.time.ns_per_s / 2);
|
||||
queue.push(1);
|
||||
queue.push(1);
|
||||
t1.join();
|
||||
|
||||
Reference in New Issue
Block a user