mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
retro_waitable_spsc: say what the write notification actually does
The comment on the producer's notify opened by claiming the consumer is told even when nothing was written, then spent the rest of the sentence explaining that the notify is skipped. The code skips it. What makes that safe is that a write fitting nothing leaves the queue exactly as the consumer last saw it, and a consumer parks only on a queue with nothing to read, which a queue too full to accept the write is not.
This commit is contained in:
1 parent
1315cb6579
commit
f668180932
1 file changed
+5
-3
@@ -90,9 +90,11 @@ size_t retro_waitable_spsc_write(retro_waitable_spsc_t *q,
|
||||
{
|
||||
size_t n = retro_spsc_write(&q->queue, data, bytes);
|
||||
|
||||
/* Told even when nothing was written: a consumer parked on a queue
|
||||
* this full is waiting on the producer, and a write that fitted
|
||||
* nothing has not changed that, so the notify is skipped. */
|
||||
/* Skipped when nothing was written: a write that fitted nothing
|
||||
* leaves the queue exactly as the consumer last saw it, and a
|
||||
* consumer only parks on a queue with nothing to read - which a
|
||||
* queue too full to accept this write is not. There is no wake to
|
||||
* lose. */
|
||||
if (n)
|
||||
retro_eventcount_notify(&q->readable);
|
||||
|
||||
|
||||
Reference in new issue
Block a user