Should Reader move `last`?
jamesmunns opened this issue · comments
James Munns commented
This comment from initial implementation states that Reader should be in charge of moving last
back to max
when necessary. See this comment
However in my current implementation, I move the last
pointer when the Writer commits a grant past the last
position. I'm not sure when this changed. This still seems sound, as the following scenarios are all good:
- read < write < last
- OK: Reader will be blocked by writer
- write < read < last
- OK: Reader will be blocked by last, then will jump back to 0, where it will be back in case 1
I should probably make sure that the ordering of these transactions are still good though, and either update the code, or update the comments
CC @utaal, I need to see what his spsc buffer does in this case