branch fixes

This commit is contained in:
Andrew Kelley
2024-10-18 22:29:50 -07:00
parent 5ca54036ca
commit c2898c436f
10 changed files with 286 additions and 429 deletions

View File

@@ -59,5 +59,13 @@ pub fn ThreadSafeQueue(comptime T: type) type {
self.state = .run;
return was_waiting;
}
/// Safe only to call exactly once when initially starting the worker.
pub fn start(self: *Self) bool {
assert(self.state == .wait);
if (self.shared.items.len == 0) return false;
self.state = .run;
return true;
}
};
}