mirror of
https://github.com/Zygo/bees.git
synced 2025-06-17 01:56:16 +02:00
bees: fix deadlock in thread status reporting
"s_name" was a thread_local variable, not static, and did not require a mutex to protect access. A deadlock is possible if a thread triggers an exception with a handler that attempts to log a message (as the top-level exception handler in bees does). Remove multiple unnecessary mutex locks. Rename the thread_local variables to make their scope clearer. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -184,7 +184,7 @@ class BeesTracer {
|
||||
function<void()> m_func;
|
||||
BeesTracer *m_next_tracer = 0;
|
||||
|
||||
thread_local static BeesTracer *s_next_tracer;
|
||||
thread_local static BeesTracer *tl_next_tracer;
|
||||
public:
|
||||
BeesTracer(function<void()> f);
|
||||
~BeesTracer();
|
||||
@ -200,8 +200,8 @@ class BeesNote {
|
||||
static mutex s_mutex;
|
||||
static map<pid_t, BeesNote*> s_status;
|
||||
|
||||
thread_local static BeesNote *s_next;
|
||||
thread_local static string s_name;
|
||||
thread_local static BeesNote *tl_next;
|
||||
thread_local static string tl_name;
|
||||
|
||||
public:
|
||||
BeesNote(function<void(ostream &)> f);
|
||||
|
Reference in New Issue
Block a user