X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Fstatic%2Furcu-bp.h;h=2f365206afad6db4c561654109def617ef559ce5;hp=c7f532640e3c0feab165cb5a699c4c3760df011d;hb=882f335739b978d1c55be2faeed077f315afe5d7;hpb=171ff3a34ac166a41a075749517fd3780df121da diff --git a/urcu/static/urcu-bp.h b/urcu/static/urcu-bp.h index c7f5326..2f36520 100644 --- a/urcu/static/urcu-bp.h +++ b/urcu/static/urcu-bp.h @@ -223,6 +223,20 @@ static inline void _rcu_read_unlock(void) cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */ } +/* + * Returns whether within a RCU read-side critical section. + * + * This function is less than 10 lines long. The intent is that this + * function meets the 10-line criterion for LGPL, allowing this function + * to be invoked directly from non-LGPL code. + */ +static inline int _rcu_read_ongoing(void) +{ + if (caa_unlikely(!URCU_TLS(rcu_reader))) + rcu_bp_register(); /* If not yet registered. */ + return URCU_TLS(rcu_reader)->ctr & RCU_GP_CTR_NEST_MASK; +} + #ifdef __cplusplus } #endif