Skip to content

Commit 5c329f6

Browse files
frankistcodebot
authored andcommitted
support: fix tsan false alarm in timer_manager class
1 parent 722973a commit 5c329f6

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lib/support/timers.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#include "cameron314/concurrentqueue.h"
1313
#include "srsran/srslog/srslog.h"
1414

15+
#ifdef ENABLE_TSAN
16+
#include "sanitizer/tsan_interface.h"
17+
#endif
18+
1519
using namespace srsran;
1620

1721
/// Timer Wheel configuration parameters.
@@ -70,18 +74,30 @@ class timer_manager::unique_timer_pool
7074
public:
7175
unique_timer_pool(timer_manager& parent, unsigned capacity) : free_list(capacity) {}
7276

73-
void push(timer_manager::timer_frontend* obj) { free_list.enqueue(obj); }
77+
void push(timer_manager::timer_frontend* obj)
78+
{
79+
#ifdef ENABLE_TSAN
80+
__tsan_release((void*)obj);
81+
#endif
82+
free_list.enqueue(obj);
83+
}
7484

7585
timer_manager::timer_frontend* pop()
7686
{
7787
timer_manager::timer_frontend* ret;
7888
if (free_list.try_dequeue(ret)) {
89+
#ifdef ENABLE_TSAN
90+
__tsan_acquire((void*)ret);
91+
#endif
7992
return ret;
8093
}
8194
return nullptr;
8295
}
8396

84-
size_t size_approx() const { return free_list.size_approx(); }
97+
size_t size_approx() const
98+
{
99+
return free_list.size_approx();
100+
}
85101

86102
private:
87103
// List of timer_handle objects in timer_list that are currently not allocated.

0 commit comments

Comments
 (0)