this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix queue drain wakeup when full

authored by

Fristender and committed by
Tim Culverhouse
14804a7c 67bbc1ee

+9 -1
+9 -1
src/queue.zig
··· 86 86 /// Used to efficiently drain the queue while the lock is externally held 87 87 pub fn drain(self: *Self) ?T { 88 88 if (self.isEmptyLH()) return null; 89 - return self.popLH(); 89 + // Preserve queue push wakeups when draining under external lock. 90 + // If the queue was full before this pop, a producer may be blocked 91 + // waiting on not_full. 92 + const was_full = self.isFullLH(); 93 + const item = self.popLH(); 94 + if (was_full) { 95 + self.not_full.signal(); 96 + } 97 + return item; 90 98 } 91 99 92 100 fn isEmptyLH(self: Self) bool {