static
void wait_for_sessiond(struct sock_info *sock_info)
{
- int ret;
+ int ret, oldtype;
ust_lock();
if (lttng_ust_comm_should_quit) {
ust_unlock();
DBG("Waiting for %s apps sessiond", sock_info->name);
+ /*
+ * sys_futex does not honor pthread cancel requests. Set to
+ * async.
+ */
+ ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
+ if (ret) {
+ ERR("Error setting thread cancel type");
+ }
/* Wait for futex wakeup */
if (uatomic_read((int32_t *) sock_info->wait_shm_mmap) == 0) {
ret = futex_async((int32_t *) sock_info->wait_shm_mmap,
}
}
}
+ ret = pthread_setcanceltype(oldtype, &oldtype);
+ if (ret) {
+ ERR("Error setting thread cancel type");
+ }
return;
quit:
lttng_ust_comm_should_quit = 1;
ust_unlock();
+ /* cancel threads */
ret = pthread_cancel(global_apps.ust_listener);
if (ret) {
ERR("Error cancelling global ust listener thread");
ERR("Error cancelling local ust listener thread");
}
}
+ /* 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");
+ }
+ }
lttng_ust_cleanup(1);
}