X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=urcu-call-rcu.c;h=9cc56c54fafc39dfabef67c984663e3ba0d0155e;hp=bb56dbb891fa0a270e7058bd18a47bfe4d554cbf;hb=81ad2e193e8072f8246212d7eaba72769306c2e4;hpb=2260a36cd53dc882bf83e39180bae4413d64da8f diff --git a/urcu-call-rcu.c b/urcu-call-rcu.c index bb56dbb..9cc56c5 100644 --- a/urcu-call-rcu.c +++ b/urcu-call-rcu.c @@ -565,14 +565,38 @@ void free_all_cpu_call_rcu_data(void) } } +/* + * Acquire the call_rcu_mutex in order to ensure that the child sees + * all of the call_rcu() data structures in a consistent state. + * Suitable for pthread_atfork() and friends. + */ +void call_rcu_before_fork(void) +{ + call_rcu_lock(&call_rcu_mutex); +} + +/* + * Clean up call_rcu data structures in the parent of a successful fork() + * that is not followed by exec() in the child. Suitable for + * pthread_atfork() and friends. + */ +void call_rcu_after_fork_parent(void) +{ + call_rcu_unlock(&call_rcu_mutex); +} + /* * Clean up call_rcu data structures in the child of a successful fork() - * that is not followed by exec(). + * that is not followed by exec(). Suitable for pthread_atfork() and + * friends. */ void call_rcu_after_fork_child(void) { struct call_rcu_data *crdp; + /* Release the mutex. */ + call_rcu_unlock(&call_rcu_mutex); + /* * Allocate a new default call_rcu_data structure in order * to get a working call_rcu thread to go with it.