-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Looking at the batching code I noticed m_mustExit being a "plain" bool, which means if I understand the C++ memory model correctly that the compiler/cpu are not required to provide visibility of the changes to other threads so the background batching thread may spin indefinitely.
suggestion: switch m_mustExit to std::atomic_bool and use memory_order_acq_rel on load()/store() [2]
[1] https://github.com/vthiery/cpp-statsd-client/blob/master/include/cpp-statsd-client/UDPSender.hpp#L76
[2] https://en.cppreference.com/w/cpp/atomic/memory_order#Release-Acquire_ordering
Metadata
Metadata
Assignees
Labels
No labels