3 ms·
One possible reason is that storing a bool separately from the index makes it difficult to update the producer or consumer index atomically. With the implement
by drv 10y ago
One possible reason is that storing a bool separately from the index makes it difficult to update the producer or consumer index atomically. With the implementations that store the full producer and consumer states as a single word each, only single-word atomic operations are necessary to build a lock-free ring. Storing the bool as the high bit of the index would also suffice.