- /* join threads */
- ret = pthread_join(global_apps.ust_listener, NULL);
- if (ret) {
- ERR("Error joining global ust listener thread");
- }
- if (local_apps.allowed) {
- ret = pthread_join(local_apps.ust_listener, NULL);
- if (ret) {
- ERR("Error joining local ust listener thread");
- }
- }
+ /*
+ * Do NOT join threads: use of sys_futex makes it impossible to
+ * join the threads without using async-cancel, but async-cancel
+ * is delivered by a signal, which could hit the target thread
+ * anywhere in its code path, including while the ust_lock() is
+ * held, causing a deadlock for the other thread. Let the OS
+ * cleanup the threads if there are stalled in a syscall.
+ */