mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-28 20:02:22 +02:00
Make RingBuffer initialization thread safe
This commit is contained in:
@@ -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