jamesmunns / bbqueue

A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should Reader move `last`?

jamesmunns opened this issue · comments

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:

  1. read < write < last
    • OK: Reader will be blocked by writer
  2. 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