Ringbuffer returns nullptr when the buffer is full

This feature will allow us to make a push/pull mechanism for the sf_h5_writer.
All classes using RingBuffer have been updated to maintain the exact same behaviour as before.
This commit is contained in:
2020-04-21 17:25:22 +02:00
parent 89328f700f
commit 77141a559c
3 changed files with 50 additions and 11 deletions
+13
View File
@@ -185,6 +185,19 @@ void ZmqRecvModule::receive_thread(const string& connect_address)
}
char* buffer = ring_buffer_.reserve(frame_metadata);
if (buffer == nullptr) {
stringstream err_msg;
using namespace date;
using namespace chrono;
err_msg << "[" << system_clock::now() << "]";
err_msg << "[UdpRecvModule::receive_thread]";
err_msg << " Ring buffer is full.";
err_msg << endl;
throw runtime_error(err_msg.str());
}
memcpy(
buffer,
static_cast<const char*>(frame_data),