Fix: lock exit mutex when creating threads
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index c6640954c6aa77d34203cbc6cda8c32eae34d7c6..6eb4a892f7bf7d343ec3d77b8e9d6ab0cea38b33 100644 (file)
@@ -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);
        }
This page took 0.023766 seconds and 4 git commands to generate.