From f1c8a0745dfcd5135305d789854ccff5b192d92f Mon Sep 17 00:00:00 2001 From: Ahmed Essam Date: Fri, 15 Sep 2023 14:52:51 +0300 Subject: [PATCH] fix incorrect error code returned --- README.md | 2 +- broadcast_queue.h | 4 ++-- tests/multi_threaded_tests.cpp | 25 ++++++++++++++----------- tests/single_threaded_tests.cpp | 22 ++++++++++++---------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 8a4c8c2..1f749ee 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ of the disruptor pattern in C++. * [Can Seqlocks Get Along With Programming Language Memory Models?][1] * [Trading at light speed: designing low latency systems in C++ - David Gross - Meeting C++ 2022][2] -* [LMAX Disruptor and the Concepts of Mechanical Sympathy] [3] +* [LMAX Disruptor and the Concepts of Mechanical Sympathy][3] * [Building a Lock-free Multi-producer, Multi-consumer Queue for Tcmalloc - Matt Kulukundis - CppCon 21][4] * [Flat Combining and the Synchronization-Parallelism Tradeoff][5] diff --git a/broadcast_queue.h b/broadcast_queue.h index 6f7ee51..617069a 100644 --- a/broadcast_queue.h +++ b/broadcast_queue.h @@ -528,7 +528,7 @@ class queue_datarefcount.load(std::memory_order_relaxed); // the block died from underneath us! if (refcount == 0) { - return Error::Timeout; + return Error::Lagged; } // try to increment refcount so that no one will dare destroy the object @@ -537,7 +537,7 @@ class queue_data struct TestTypes { }; using MyTypes = ::testing::Types< - TestTypes, - TestTypes, - TestTypes, broadcast_queue::default_waiting_strategy>, + TestTypes, + TestTypes, + TestTypes, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, - TestTypes, - TestTypes, - TestTypes, broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, + TestTypes, + TestTypes, + TestTypes, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, - TestTypes, + broadcast_queue::condition_variable_waiting_strategy>, + TestTypes, TestTypes, TestTypes, TestTypes, diff --git a/tests/single_threaded_tests.cpp b/tests/single_threaded_tests.cpp index b82a1e2..bf04163 100644 --- a/tests/single_threaded_tests.cpp +++ b/tests/single_threaded_tests.cpp @@ -18,20 +18,22 @@ template struct TestTypes { }; using MyTypes = ::testing::Types< - TestTypes, - TestTypes, - TestTypes, broadcast_queue::default_waiting_strategy>, + TestTypes, + TestTypes, + TestTypes, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, - TestTypes, - TestTypes, - TestTypes, broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, + TestTypes, + TestTypes, + TestTypes, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, - broadcast_queue::default_waiting_strategy>, + broadcast_queue::condition_variable_waiting_strategy>, TestTypes, TestTypes, TestTypes,