From ef84facf4b0c23bd695ca9300055e3ffc9b56006 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Fri, 3 Jun 2011 12:44:50 -0400 Subject: [PATCH] Allow taking address of rcu_read_lock() and rcu_read_unlock() Also incorporate README feedback from Mathieu and Josh. Signed-off-by: Paul E. McKenney Signed-off-by: Mathieu Desnoyers --- README | 9 ++++++--- urcu-bp.h | 4 ++-- urcu-qsbr.h | 10 +++++----- urcu.h | 12 ++++++------ 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README b/README index 56e98d7..659511f 100644 --- a/README +++ b/README @@ -205,6 +205,9 @@ Interaction with fork() rcu_bp_before_fork, rcu_bp_after_fork_parent and rcu_bp_after_fork_child. - Applications that use call_rcu() are required to invoke - call_rcu_after_fork_child() from the child process after a - successful fork() system call that is not followed by exec(). + Applications that use call_rcu() and that fork() without + doing an immediate exec() must take special action. The parent + must invoke call_rcu_before_fork() before the fork() and + call_rcu_after_fork_parent() after the fork(). The child + process must invoke call_rcu_after_fork_child(). + These three APIs are suitable for passing to pthread_atfork(). diff --git a/urcu-bp.h b/urcu-bp.h index fdf885c..bc2dbc3 100644 --- a/urcu-bp.h +++ b/urcu-bp.h @@ -71,8 +71,8 @@ extern "C" { * * Mark the beginning and end of a read-side critical section. */ -#define rcu_read_lock_bp() _rcu_read_lock() -#define rcu_read_unlock_bp() _rcu_read_unlock() +#define rcu_read_lock_bp _rcu_read_lock +#define rcu_read_unlock_bp _rcu_read_unlock #else /* !_LGPL_SOURCE */ diff --git a/urcu-qsbr.h b/urcu-qsbr.h index 984d70c..7ef1bfe 100644 --- a/urcu-qsbr.h +++ b/urcu-qsbr.h @@ -67,12 +67,12 @@ extern "C" { * DON'T FORGET TO USE rcu_register_thread/rcu_unregister_thread() * FOR EACH THREAD WITH READ-SIDE CRITICAL SECTION. */ -#define rcu_read_lock_qsbr() _rcu_read_lock() -#define rcu_read_unlock_qsbr() _rcu_read_unlock() +#define rcu_read_lock_qsbr _rcu_read_lock +#define rcu_read_unlock_qsbr _rcu_read_unlock -#define rcu_quiescent_state_qsbr() _rcu_quiescent_state() -#define rcu_thread_offline_qsbr() _rcu_thread_offline() -#define rcu_thread_online_qsbr() _rcu_thread_online() +#define rcu_quiescent_state_qsbr _rcu_quiescent_state +#define rcu_thread_offline_qsbr _rcu_thread_offline +#define rcu_thread_online_qsbr _rcu_thread_online #else /* !_LGPL_SOURCE */ diff --git a/urcu.h b/urcu.h index 00d9b75..417e609 100644 --- a/urcu.h +++ b/urcu.h @@ -71,14 +71,14 @@ extern "C" { * READ-SIDE CRITICAL SECTION. */ #ifdef RCU_MEMBARRIER -#define rcu_read_lock_memb() _rcu_read_lock() -#define rcu_read_unlock_memb() _rcu_read_unlock() +#define rcu_read_lock_memb _rcu_read_lock +#define rcu_read_unlock_memb _rcu_read_unlock #elif defined(RCU_SIGNAL) -#define rcu_read_lock_sig() _rcu_read_lock() -#define rcu_read_unlock_sig() _rcu_read_unlock() +#define rcu_read_lock_sig _rcu_read_lock +#define rcu_read_unlock_sig _rcu_read_unlock #elif defined(RCU_MB) -#define rcu_read_lock_mb() _rcu_read_lock() -#define rcu_read_unlock_mb() _rcu_read_unlock() +#define rcu_read_lock_mb _rcu_read_lock +#define rcu_read_unlock_mb _rcu_read_unlock #endif #else /* !_LGPL_SOURCE */ -- 2.34.1