Expose move result from LockFreeRingBuffer::Cursor
Summary: Without feedback that a `moveForward` or `moveBackward` did nothing, a user cannot implement this idiom safely: ``` while(rb.tryRead(entry, cursor)) { doSomething(entry); cursor.moveBackward(); } ``` In the case where the ring buffer has not overflowed and slot 0 is still available, the reader will get stuck at it (read it continuously) until the buffer overflows. This diff allows the above example to become: ``` while(rb.tryRead(entry, cursor)) { doSomething(etnry); if (!cursor.moveBackward()) { break; } } ``` Reviewed By: bryceredd Differential Revision: D2674975 fb-gh-sync-id: a0c5857daf186ef19e203f90acc2145590f85c3b
Showing
Please register or sign in to comment