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>
13 #include "common/logging.h"
15 struct ust_cancelstate
{
17 int oldstate
; /* oldstate for outermost nesting */
20 static DEFINE_URCU_TLS(struct ust_cancelstate
, thread_state
);
22 int lttng_ust_cancelstate_disable_push(void)
24 struct ust_cancelstate
*state
= &URCU_TLS(thread_state
);
29 ret
= pthread_setcancelstate(PTHREAD_CANCEL_DISABLE
, &oldstate
);
31 ERR("pthread_setcancelstate: %s", strerror(ret
));
34 state
->oldstate
= oldstate
;
39 int lttng_ust_cancelstate_disable_pop(void)
41 struct ust_cancelstate
*state
= &URCU_TLS(thread_state
);
48 ret
= pthread_setcancelstate(state
->oldstate
, &oldstate
);
50 ERR("pthread_setcancelstate: %s", strerror(ret
));
53 if (oldstate
!= PTHREAD_CANCEL_DISABLE
) {
54 ERR("pthread_setcancelstate: unexpected oldstate");
This page took 0.031996 seconds and 5 git commands to generate.