X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;ds=sidebyside;f=urcu.h;h=3c5b178d1a8254adb37331fea6b61698a58c459c;hb=5e7e64b952ac49cf61c4c3bfc02e5938c3691d94;hp=bee7715270794c3e83cede4acb1741a98d361ac6;hpb=41718ff94c4a07cb5f56d68084267798e471d1b1;p=urcu.git diff --git a/urcu.h b/urcu.h index bee7715..3c5b178 100644 --- a/urcu.h +++ b/urcu.h @@ -1,6 +1,22 @@ #ifndef _URCU_H #define _URCU_H +/* + * urcu.h + * + * Userspace RCU header + * + * Copyright February 2009 - Mathieu Desnoyers + * + * Credits for Paul e. McKenney + * for inspiration coming from the Linux kernel RCU and rcu-preempt. + * + * The barrier, mb, rmb, wmb, atomic_inc, smp_read_barrier_depends, ACCESS_ONCE + * and rcu_dereference primitives come from the Linux kernel. + * + * Distributed under GPLv2 + */ + /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") @@ -9,9 +25,6 @@ #define rmb() asm volatile("lfence":::"memory") #define wmb() asm volatile("sfence" ::: "memory") - - -/* x86 32 */ static inline void atomic_inc(int *v) { asm volatile("lock; incl %0" @@ -91,12 +104,18 @@ static inline void rcu_read_unlock(int urcu_parity) extern void rcu_write_lock(void); extern void rcu_write_unlock(void); -extern void *urcu_publish_content(void **ptr, void *new); +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) /* * Reader thread registration. */ extern void urcu_register_thread(void); -extern void urcu_register_thread(void); +extern void urcu_unregister_thread(void); #endif /* _URCU_H */