this repo has no description
13
fork

Configure Feed

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

Make sure we add to the queue before we signal a pop

The queue was signaling a pop that's waiting for the queue to not be
empty before we had actually added something to the queue. This change
moves the signal to after the push has been done so we're not signaling
a pop with a still-empty queue.

authored by

Kristófer R and committed by
Tim Culverhouse
2b3bdae6 4182b7fa

+6 -4
+6 -4
src/queue.zig
··· 49 49 while (self.isFullLH()) { 50 50 self.not_full.wait(&self.mutex); 51 51 } 52 - if (self.isEmptyLH()) { 53 - // If we were empty, wake up a pop if it was waiting. 54 - self.not_empty.signal(); 55 - } 56 52 std.debug.assert(!self.isFullLH()); 53 + const was_empty = self.isEmptyLH(); 57 54 58 55 self.buf[self.mask(self.write_index)] = item; 59 56 self.write_index = self.mask2(self.write_index + 1); 57 + 58 + // If we were empty, wake up a pop if it was waiting. 59 + if (was_empty) { 60 + self.not_empty.signal(); 61 + } 60 62 } 61 63 62 64 /// Push an item into the queue. Returns true when the item