2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #include <urcu/tls-compat.h>
11 #include <lttng/ust-cancelstate.h>
12 #include <usterr-signal-safe.h>
14 struct ust_cancelstate
{
16 int oldstate
; /* oldstate for outermost nesting */
19 static DEFINE_URCU_TLS(struct ust_cancelstate
, thread_state
);
21 int lttng_ust_cancelstate_disable_push(void)
23 struct ust_cancelstate
*state
= &URCU_TLS(thread_state
);
28 ret
= pthread_setcancelstate(PTHREAD_CANCEL_DISABLE
, &oldstate
);
30 ERR("pthread_setcancelstate: %s", strerror(ret
));
33 state
->oldstate
= oldstate
;
38 int lttng_ust_cancelstate_disable_pop(void)
40 struct ust_cancelstate
*state
= &URCU_TLS(thread_state
);
47 ret
= pthread_setcancelstate(state
->oldstate
, &oldstate
);
49 ERR("pthread_setcancelstate: %s", strerror(ret
));
52 if (oldstate
!= PTHREAD_CANCEL_DISABLE
) {
53 ERR("pthread_setcancelstate: unexpected oldstate");
This page took 0.05463 seconds and 5 git commands to generate.