Make the buffer owned and managed by the manager
Closes #61 (closed)
With these changes the buffer is not owned by the manager so the user can not directly access it. However this doesn't make it 100% safe from the user. They still have to make sure that it's used safely inside the inherited manager class. So to make it 100% safe we would still need a mutex on the buffer class. But if you prefer to avoid it, this current solution with some comments could be a compromise.
I checked your comment about removing the mutex from the metadata buffer. The same transfer of ownership could be done for the metadata buffer. I went through the code and if I didn't miss anything in the current implementation it would be ok to remove the mutex in metadata buffer, as long as addWrStampMetaData
, addTriggerMetaData
together with the updateWindow*
functions are all only called from the pushing thread. In addition to the manager the metadata buffer is used within CircularWindowIterator::updateMetaWindowAccordingToSampleWindow
also which currently is only called from managers updateWindow
functions which should make it safe (but it's a public method so it's not a guarantee). However cases like this all make it really easy to call some function from some other thread in the future. So I am not sure if just removing the mutex and calling it a day is the way to do it.