Make sure to protect the bare CircularBuffer for concurrent access
Followup of granular-mutexing discussion on #31 (closed)
Currently, the buffer itself (aka class CircularBuffer
) is exposed to the user, and we rely on the user to use it in the right way / don't use it from within multiple threads.
Another reason for possible need for mutex usage could be window validation ... to be discussed in #60 (closed)
Possible Solution 1:
We could only expose the BufferManager
to the user, so that we are in full control of the CircularBuffer
/CircularBufferDual
and make sure that it is used in the right way.
In order to accomplish that, it probably would be required to have #30 (closed) fixed. BufferManager
could then just share the same template type than CircularBuffer
, create it itself (currently it needs to be injected by the user) and keep it private.
Possible Solution 2:
We could restrict access to the write iterator of CircularBuffer
by using a mutex on all related methods, like described in #31 (comment 51695)