From 626f24c9f9a5ed89afc83cac45ac19d5d0682b0c Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 7 Jun 2021 11:51:54 +0200 Subject: [PATCH] block_queue: use class mutex to protect size() getter detected with TSAN --- lib/include/srsran/common/block_queue.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/include/srsran/common/block_queue.h b/lib/include/srsran/common/block_queue.h index 7982d191c..479f474d2 100644 --- a/lib/include/srsran/common/block_queue.h +++ b/lib/include/srsran/common/block_queue.h @@ -121,7 +121,14 @@ public: const myobj& front() const { return q.front(); } - size_t size() { return q.size(); } + size_t size() + { + size_t len = 0; + pthread_mutex_lock(&mutex); + len = q.size(); + pthread_mutex_unlock(&mutex); + return len; + } private: bool pop_(myobj* value, bool block)