Skip to content
Snippets Groups Projects
Commit f1f937a5 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

ringbuffer: fix uninitialzed return variable

If timeout is reached waitForDataAvailable would return a garbage variable.

Refs #45117
parent c471b336
Branches
Tags
No related merge requests found
...@@ -262,7 +262,7 @@ size_t RingBuffer::waitForDataAvailable(const std::string &call_id, const size_t ...@@ -262,7 +262,7 @@ size_t RingBuffer::waitForDataAvailable(const std::string &call_id, const size_t
if(buffer_size < min_data_length) return 0; if(buffer_size < min_data_length) return 0;
ReadPointer::const_iterator read_ptr = readpointers_.find(call_id); ReadPointer::const_iterator read_ptr = readpointers_.find(call_id);
if(read_ptr == readpointers_.end()) return 0; if(read_ptr == readpointers_.end()) return 0;
size_t getl; size_t getl = 0;
if (deadline == std::chrono::high_resolution_clock::time_point()) { if (deadline == std::chrono::high_resolution_clock::time_point()) {
not_empty_.wait(l, [=, &getl]{ not_empty_.wait(l, [=, &getl]{
getl = (endPos_ + buffer_size - read_ptr->second) % buffer_size; getl = (endPos_ + buffer_size - read_ptr->second) % buffer_size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment