X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Furcu-call-rcu-impl.h;h=c01f02b2f5c7400edf8c9ed191c87a9cc5b9d52c;hb=caefd1ee4699652c808cd1863ea40a2ad4a25710;hp=c264da5f7775c623d0e9ae952ceed38a8be90add;hpb=9f75d2d92dad5f19f57c4bd4866d5658971b287c;p=urcu.git diff --git a/src/urcu-call-rcu-impl.h b/src/urcu-call-rcu-impl.h index c264da5..c01f02b 100644 --- a/src/urcu-call-rcu-impl.h +++ b/src/urcu-call-rcu-impl.h @@ -81,6 +81,10 @@ struct call_rcu_completion_work { struct call_rcu_completion *completion; }; +enum crdf_flags { + CRDF_FLAG_JOIN_THREAD = (1 << 0), +}; + /* * List of all call_rcu_data structures to keep valgrind happy. * Protected by call_rcu_mutex. @@ -755,7 +759,8 @@ void call_rcu(struct rcu_head *head, * a list corruption bug in the 0.7.x series. The equivalent fix * appeared in 0.6.8 for the stable-0.6 branch. */ -void call_rcu_data_free(struct call_rcu_data *crdp) +static +void _call_rcu_data_free(struct call_rcu_data *crdp, unsigned int flags) { if (crdp == NULL || crdp == default_call_rcu_data) { return; @@ -784,9 +789,21 @@ void call_rcu_data_free(struct call_rcu_data *crdp) cds_list_del(&crdp->list); call_rcu_unlock(&call_rcu_mutex); + if (flags & CRDF_FLAG_JOIN_THREAD) { + int ret; + + ret = pthread_join(get_call_rcu_thread(crdp), NULL); + if (ret) + urcu_die(ret); + } free(crdp); } +void call_rcu_data_free(struct call_rcu_data *crdp) +{ + _call_rcu_data_free(crdp, CRDF_FLAG_JOIN_THREAD); +} + /* * Clean up all the per-CPU call_rcu threads. */ @@ -1011,7 +1028,11 @@ void call_rcu_after_fork_child(void) if (crdp == default_call_rcu_data) continue; uatomic_set(&crdp->flags, URCU_CALL_RCU_STOPPED); - call_rcu_data_free(crdp); + /* + * Do not join the thread because it does not exist in + * the child. + */ + _call_rcu_data_free(crdp, 0); } }