Fix: relayd and sessiond: dispatch thread exit is shared across threads
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 23 Jul 2012 15:31:34 +0000 (11:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 23 Jul 2012 15:31:34 +0000 (11:31 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-relayd/main.c
src/bin/lttng-sessiond/main.c

index 0428d33cef82d7f3c18bcff03f2310433808f7bf..81f10b78368c46401085477a51b799f90cf8fb19 100644 (file)
@@ -74,6 +74,7 @@ static int thread_quit_pipe[2] = { -1, -1 };
  */
 static int relay_cmd_pipe[2] = { -1, -1 };
 
+/* Shared between threads */
 static int dispatch_thread_exit;
 
 static pthread_t listener_thread;
@@ -272,7 +273,7 @@ void stop_threads(void)
        }
 
        /* Dispatch thread */
-       dispatch_thread_exit = 1;
+       CMM_STORE_SHARED(dispatch_thread_exit, 1);
        futex_nto1_wake(&relay_cmd_queue.futex);
 }
 
@@ -608,7 +609,7 @@ void *relay_thread_dispatcher(void *data)
 
        DBG("[thread] Relay dispatcher started");
 
-       while (!dispatch_thread_exit) {
+       while (!CMM_LOAD_SHARED(dispatch_thread_exit)) {
                /* Atomically prepare the queue futex */
                futex_nto1_prepare(&relay_cmd_queue.futex);
 
index 85b960ee3c23be267d4b5558e9c1dc661539583e..5664b0be1e86c46e4c2d4f4b1e42250fb30cee8e 100644 (file)
@@ -103,6 +103,7 @@ static struct consumer_data ustconsumer32_data = {
        .cmd_sock = -1,
 };
 
+/* Shared between threads */
 static int dispatch_thread_exit;
 
 /* Global application Unix socket path */
@@ -420,7 +421,7 @@ static void stop_threads(void)
        }
 
        /* Dispatch thread */
-       dispatch_thread_exit = 1;
+       CMM_STORE_SHARED(dispatch_thread_exit, 1);
        futex_nto1_wake(&ust_cmd_queue.futex);
 }
 
@@ -1219,7 +1220,7 @@ static void *thread_dispatch_ust_registration(void *data)
 
        DBG("[thread] Dispatch UST command started");
 
-       while (!dispatch_thread_exit) {
+       while (!CMM_LOAD_SHARED(dispatch_thread_exit)) {
                /* Atomically prepare the queue futex */
                futex_nto1_prepare(&ust_cmd_queue.futex);
 
This page took 0.038406 seconds and 4 git commands to generate.