aboutsummaryrefslogtreecommitdiff
path: root/src/ThreadSafeQueue.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ThreadSafeQueue.zig')
-rw-r--r--src/ThreadSafeQueue.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ThreadSafeQueue.zig b/src/ThreadSafeQueue.zig
index 1cf6aaaa3a..74bbdc418f 100644
--- a/src/ThreadSafeQueue.zig
+++ b/src/ThreadSafeQueue.zig
@@ -52,12 +52,13 @@ pub fn ThreadSafeQueue(comptime T: type) type {
self.mutex.lock();
defer self.mutex.unlock();
try self.shared.appendSlice(gpa, items);
- const was_waiting = switch (self.state) {
+ return switch (self.state) {
.run => false,
- .wait => true,
+ .wait => {
+ self.state = .run;
+ return true;
+ },
};
- self.state = .run;
- return was_waiting;
}
/// Safe only to call exactly once when initially starting the worker.