[lttng-dev] [PATCH 2/2] urcu: add notice to URCU_TLS() for it is not async-signal-safe
Lai Jiangshan
laijs at cn.fujitsu.com
Wed Aug 8 04:31:13 EDT 2012
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
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
More information about the lttng-dev
mailing list