Handle fork() gracefully with urcu-bp. Dependency on urcu-bp 0.5.4.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Hold listen_sock_mutex to protect from listen_sock teardown.
*/
pthread_mutex_lock(&listen_sock_mutex);
* Hold listen_sock_mutex to protect from listen_sock teardown.
*/
pthread_mutex_lock(&listen_sock_mutex);
}
/* Don't call this function directly in a traced program */
}
/* Don't call this function directly in a traced program */
void ust_after_fork_parent(ust_fork_info_t *fork_info)
{
void ust_after_fork_parent(ust_fork_info_t *fork_info)
{
+ rcu_bp_after_fork_parent();
/* Release mutexes and reenable signals */
ust_after_fork_common(fork_info);
}
void ust_after_fork_child(ust_fork_info_t *fork_info)
{
/* Release mutexes and reenable signals */
ust_after_fork_common(fork_info);
}
void ust_after_fork_child(ust_fork_info_t *fork_info)
{
- /* First sanitize the child */
+ /* Release urcu mutexes */
+ rcu_bp_after_fork_child();
+
+ /* Sanitize the child */
ust_fork();
/* Then release mutexes and reenable signals */
ust_after_fork_common(fork_info);
ust_fork();
/* Then release mutexes and reenable signals */
ust_after_fork_common(fork_info);
-
- /*
- * Make sure we clean up the urcu-bp thread list in the child by running
- * the garbage collection before any pthread_create can be called.
- * Failure to do so could lead to a deadlock caused by reuse of a thread
- * ID before urcu-bp garbage collection is performed.
- */
- synchronize_rcu();