X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.h;h=b6b5c7b039e359225d947afb91a29a2f25ba6a3c;hp=9431da547bfcc8245d07969de426ac33c7fe3d2d;hb=c265818b951224bcde407b1efa14f9daf44949b3;hpb=cdcb92bbb9e54201e0982844e3ca9cb4fd9b31e5 diff --git a/urcu.h b/urcu.h index 9431da5..b6b5c7b 100644 --- a/urcu.h +++ b/urcu.h @@ -77,33 +77,29 @@ 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); /*