diff --git a/lib/isc/include/isc/loop.h b/lib/isc/include/isc/loop.h index f02c0925d6..d2d8c29054 100644 --- a/lib/isc/include/isc/loop.h +++ b/lib/isc/include/isc/loop.h @@ -225,4 +225,14 @@ isc_loop_shuttingdown(isc_loop_t *loop); * * \li 'loop' is a valid loop and the loop tid matches the current tid. */ + +void +isc_loop_rcu_barrier(isc_loop_t *loop); +/*%< + * Triggers an rcu_barrier() call at the end of the current loop tick. + * + * Requires: + * + * \li 'loop' is a valid loop and the loop tid matches the current tid. + */ ISC_LANG_ENDDECLS diff --git a/lib/isc/loop.c b/lib/isc/loop.c index 5cad59e2e6..ae4d139b25 100644 --- a/lib/isc/loop.c +++ b/lib/isc/loop.c @@ -236,7 +236,7 @@ loop_init(isc_loop_t *loop, isc_loopmgr_t *loopmgr, uint32_t tid) { static void quiescent_cb(uv_prepare_t *handle) { - UNUSED(handle); + isc_loop_t *loop = uv_handle_get_data(handle); #if defined(RCU_QSBR) /* safe memory reclamation */ @@ -247,6 +247,10 @@ quiescent_cb(uv_prepare_t *handle) { #else INSIST(!rcu_read_ongoing()); #endif + + if (loop->rcu_barrier) { + rcu_barrier(); + } } static void @@ -624,3 +628,11 @@ isc_loop_shuttingdown(isc_loop_t *loop) { return (loop->shuttingdown); } + +void +isc_loop_rcu_barrier(isc_loop_t *loop) { + REQUIRE(VALID_LOOP(loop)); + REQUIRE(loop->tid == isc_tid()); + + loop->rcu_barrier = true; +} diff --git a/lib/isc/loop_p.h b/lib/isc/loop_p.h index 185406d0d7..ed7d05856f 100644 --- a/lib/isc/loop_p.h +++ b/lib/isc/loop_p.h @@ -76,6 +76,8 @@ struct isc_loop { /* safe memory reclamation */ uv_prepare_t quiescent; + + bool rcu_barrier; }; /*