[lttng-dev] [PATCH 2/2] urcu: add notice to URCU_TLS() for it is not async-signal-safe

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Sep 6 19:07:25 EDT 2012


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>

Finally, I'm merging this patch, and I won't go for the signal-disabling
implementation, mainly because we have the same kind of behavior with
the TLS fixup for TLS variables in DSO. So this comment apply both to
the TLS and pthread getspecific implementation of the URCU_TLS, so I'm
moving it slightly higher in the header file.

Thanks!

Mathieu

> ---
>  urcu/tls-compat.h |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/urcu/tls-compat.h b/urcu/tls-compat.h
> index 192a536..b7bf363 100644
> --- a/urcu/tls-compat.h
> +++ b/urcu/tls-compat.h
> @@ -59,6 +59,20 @@ extern "C" {
>  
>  #else /* #ifndef CONFIG_RCU_TLS */
>  
> +/*
> + * NOTE: URCU_TLS() is NOT async-signal-safe, you can't use it
> + * inside any function which can be called from signal handler.
> + *
> + * But if pthread_getspecific() is async-signal-safe in your
> + * platform, you can make URCU_TLS() async-signal-safe via:
> + * ensuring the first call to URCU_TLS() of a given TLS variable of
> + * all threads is called earliest from a non-signal handler function.
> + *
> + * Exmaple: In any thread, the first call of URCU_TLS(rcu_reader)
> + * is called from rcu_register_thread(), so we can ensure all later
> + * URCU_TLS(rcu_reader) in any thread is async-signal-safe.
> + */
> +
>  # include <pthread.h>
>  
>  struct urcu_tls {
> -- 
> 1.7.4.4
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list