Zig 0.16: Thread.Condition -> Io.Condition

This commit is contained in:
LN Liberda 2026-05-22 23:51:44 +02:00
parent e447acd83c
commit b8d2702f04

View file

@ -164,7 +164,7 @@ const State = struct {
queue: [QUEUE_SIZE]*Dir = undefined,
queue_len: std.atomic.Value(usize) = std.atomic.Value(usize).init(0),
queue_lock: std.Io.Mutex = .init,
queue_cond: std.Thread.Condition = .{},
queue_cond: std.Io.Condition = .init,
threads: []Thread,
waiting: usize = 0,
@ -183,7 +183,7 @@ const State = struct {
const slot = self.queue_len.fetchAdd(1, .monotonic);
self.queue[slot] = d;
}
self.queue_cond.signal();
self.queue_cond.signal(main.io);
return true;
}
@ -195,10 +195,10 @@ const State = struct {
self.waiting += 1;
while (self.queue_len.load(.monotonic) == 0) {
if (self.waiting == self.threads.len) {
self.queue_cond.broadcast();
self.queue_cond.broadcast(main.io);
return null;
}
self.queue_cond.wait(&self.queue_lock);
self.queue_cond.wait(main.io, &self.queue_lock) catch unreachable;
}
self.waiting -= 1;