From c0bbbd5af5c91c2f7b7b23fcc860b3e48754c059 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 4 Dec 2013 23:08:17 +0100 Subject: [PATCH] Fix: lock exit mutex when creating threads Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ust-comm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index c6640954..6eb4a892 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -1380,24 +1380,24 @@ void __attribute__((constructor)) lttng_ust_init(void) ERR("pthread_attr_setdetachstate: %s", strerror(ret)); } - ust_lock_nocheck(); + pthread_mutex_lock(&ust_exit_mutex); ret = pthread_create(&global_apps.ust_listener, &thread_attr, ust_listener_thread, &global_apps); if (ret) { ERR("pthread_create global: %s", strerror(ret)); } global_apps.thread_active = 1; - ust_unlock(); + pthread_mutex_unlock(&ust_exit_mutex); if (local_apps.allowed) { - ust_lock_nocheck(); + pthread_mutex_lock(&ust_exit_mutex); ret = pthread_create(&local_apps.ust_listener, &thread_attr, ust_listener_thread, &local_apps); if (ret) { ERR("pthread_create local: %s", strerror(ret)); } local_apps.thread_active = 1; - ust_unlock(); + pthread_mutex_unlock(&ust_exit_mutex); } else { handle_register_done(&local_apps); } -- 2.34.1