mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-11-28 20:47:47 +01:00
Make RingBuffer initialization thread safe
This commit is contained in:
1 parent
d571cdfed7
commit
233c483fc7
1 file changed
+7
-2
@@ -69,9 +69,14 @@ void RingBuffer::initialize(size_t slot_size)
|
||||
|
||||
char* RingBuffer::reserve(shared_ptr<FrameMetadata> frame_metadata)
|
||||
{
|
||||
// TODO: Synchronize this as well.
|
||||
if (!ring_buffer_initialized_) {
|
||||
initialize(frame_metadata->frame_bytes_size);
|
||||
{
|
||||
lock_guard<mutex> lock(ringbuffer_slots_mutex_);
|
||||
|
||||
if (!ring_buffer_initialized_) {
|
||||
initialize(frame_metadata->frame_bytes_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (frame_metadata->frame_bytes_size > slot_size_) {
|
||||
|
||||
Reference in new issue
Block a user