Fix: thread exit vs futex wait/wakeup race
[lttng-tools.git] / src / bin / lttng-relayd / main.c
index 2fcc60af00d9d3b29b9809865ed7747ab4dbde45..0eb8e28251f2451ab229dc41cf0e62726fddc7c5 100644 (file)
@@ -977,12 +977,16 @@ static void *relay_thread_dispatcher(void *data)
 
        health_code_update();
 
-       while (!CMM_LOAD_SHARED(dispatch_thread_exit)) {
+       for (;;) {
                health_code_update();
 
                /* Atomically prepare the queue futex */
                futex_nto1_prepare(&relay_conn_queue.futex);
 
+               if (CMM_LOAD_SHARED(dispatch_thread_exit)) {
+                       break;
+               }
+
                do {
                        health_code_update();
 
This page took 0.022904 seconds and 4 git commands to generate.