X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=urcu.h;h=b6b5c7b039e359225d947afb91a29a2f25ba6a3c;hb=c265818b951224bcde407b1efa14f9daf44949b3;hp=3c5b178d1a8254adb37331fea6b61698a58c459c;hpb=5e7e64b952ac49cf61c4c3bfc02e5938c3691d94;p=urcu.git diff --git a/urcu.h b/urcu.h index 3c5b178..b6b5c7b 100644 --- a/urcu.h +++ b/urcu.h @@ -77,40 +77,30 @@ static inline int get_urcu_qparity(void) } /* - * returns urcu_parity. + * urcu_parity should be declared on the caller's stack. */ -static inline int rcu_read_lock(void) +static inline void rcu_read_lock(int *urcu_parity) { - int urcu_parity = get_urcu_qparity(); - urcu_active_readers[urcu_parity]++; + *urcu_parity = get_urcu_qparity(); + urcu_active_readers[*urcu_parity]++; /* * Increment active readers count before accessing the pointer. * See force_mb_all_threads(). */ barrier(); - return urcu_parity; } -static inline void rcu_read_unlock(int urcu_parity) +static inline void rcu_read_unlock(int *urcu_parity) { barrier(); /* * Finish using rcu before decrementing the pointer. * See force_mb_all_threads(). */ - urcu_active_readers[urcu_parity]--; + urcu_active_readers[*urcu_parity]--; } -extern void rcu_write_lock(void); -extern void rcu_write_unlock(void); - -extern void *_urcu_publish_content(void **ptr, void *new); - -/* - * gcc does not like automatic &struct ... * -> void **. - * Remove the warning. (hopefully this is ok) - */ -#define urcu_publish_content(ptr, new) _urcu_publish_content((void **)ptr, new) +extern void *urcu_publish_content(void **ptr, void *new); /* * Reader thread registration.