#include <lttng/ust-thread.h>
#include <lttng/ust-tracer.h>
#include <lttng/ust-common.h>
+#include <lttng/ust-cancelstate.h>
#include <urcu/tls-compat.h>
#include "lib/lttng-ust/futex.h"
#include "common/ustcomm.h"
int ust_lock(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret, oldstate;
+ int ret;
- ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
- if (ret) {
- ERR("pthread_setcancelstate: %s", strerror(ret));
- }
- if (oldstate != PTHREAD_CANCEL_ENABLE) {
- ERR("pthread_setcancelstate: unexpected oldstate");
+ if (lttng_ust_cancelstate_disable_push()) {
+ ERR("lttng_ust_cancelstate_disable_push");
}
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
void ust_lock_nocheck(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret, oldstate;
+ int ret;
- ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
- if (ret) {
- ERR("pthread_setcancelstate: %s", strerror(ret));
- }
- if (oldstate != PTHREAD_CANCEL_ENABLE) {
- ERR("pthread_setcancelstate: unexpected oldstate");
+ if (lttng_ust_cancelstate_disable_push()) {
+ ERR("lttng_ust_cancelstate_disable_push");
}
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
void ust_unlock(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret, oldstate;
+ int ret;
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
- ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
- if (ret) {
- ERR("pthread_setcancelstate: %s", strerror(ret));
- }
- if (oldstate != PTHREAD_CANCEL_DISABLE) {
- ERR("pthread_setcancelstate: unexpected oldstate");
+ if (lttng_ust_cancelstate_disable_pop()) {
+ ERR("lttng_ust_cancelstate_disable_pop");
}
}
}
sock_info->root_handle = -1;
}
- sock_info->registration_done = 0;
- sock_info->initial_statedump_done = 0;
+
/*
* wait_shm_mmap, socket and notify socket are used by listener
if (exiting)
return;
+ sock_info->registration_done = 0;
+ sock_info->initial_statedump_done = 0;
+
if (sock_info->socket != -1) {
ret = ustcomm_close_unix_sock(sock_info->socket);
if (ret) {