From: Mathieu Desnoyers Date: Fri, 10 Jun 2011 20:02:31 +0000 (-0400) Subject: Rename urcu/urcu_ref.h to urcu/ref.h X-Git-Tag: v0.6.0~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f9bf6d545e9e4801bec75043d716f9810ca1024d;p=userspace-rcu.git Rename urcu/urcu_ref.h to urcu/ref.h Signed-off-by: Mathieu Desnoyers --- diff --git a/Makefile.am b/Makefile.am index 53268e5..44906fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h \ urcu/rculist.h urcu/rcuhlist.h urcu/system.h urcu/urcu-futex.h \ urcu/uatomic/generic.h urcu/arch/generic.h urcu/wfstack.h \ urcu/wfqueue.h urcu/rculfstack.h urcu/rculfqueue.h \ - urcu/urcu_ref.h urcu/map/*.h urcu/static/*.h + urcu/ref.h urcu/map/*.h urcu/static/*.h nobase_nodist_include_HEADERS = urcu/arch.h urcu/uatomic.h urcu/config.h EXTRA_DIST = $(top_srcdir)/urcu/arch/*.h $(top_srcdir)/urcu/uatomic/*.h \ diff --git a/urcu/rculfqueue.h b/urcu/rculfqueue.h index c3084b7..fbef6f9 100644 --- a/urcu/rculfqueue.h +++ b/urcu/rculfqueue.h @@ -23,7 +23,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include #ifdef __cplusplus diff --git a/urcu/ref.h b/urcu/ref.h new file mode 100644 index 0000000..a422a99 --- /dev/null +++ b/urcu/ref.h @@ -0,0 +1,48 @@ +#ifndef _URCU_REF_H +#define _URCU_REF_H + +/* + * Userspace RCU - Reference counting + * + * Copyright (C) 2009 Novell Inc. + * Copyright (C) 2010 Mathieu Desnoyers + * + * Author: Jan Blunck + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 2.1 as + * published by the Free Software Foundation. + */ + +#include +#include + +struct urcu_ref { + long refcount; /* ATOMIC */ +}; + +static inline void urcu_ref_set(struct urcu_ref *ref, long val) +{ + uatomic_set(&ref->refcount, val); +} + +static inline void urcu_ref_init(struct urcu_ref *ref) +{ + urcu_ref_set(ref, 1); +} + +static inline void urcu_ref_get(struct urcu_ref *ref) +{ + uatomic_add(&ref->refcount, 1); +} + +static inline void urcu_ref_put(struct urcu_ref *ref, + void (*release)(struct urcu_ref *)) +{ + long res = uatomic_sub_return(&ref->refcount, 1); + assert (res >= 0); + if (res == 0) + release(ref); +} + +#endif /* _URCU_REF_H */ diff --git a/urcu/static/rculfqueue.h b/urcu/static/rculfqueue.h index 75df985..b627e45 100644 --- a/urcu/static/rculfqueue.h +++ b/urcu/static/rculfqueue.h @@ -26,7 +26,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include #include /* A urcu implementation header should be already included. */ diff --git a/urcu/urcu_ref.h b/urcu/urcu_ref.h deleted file mode 100644 index a422a99..0000000 --- a/urcu/urcu_ref.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _URCU_REF_H -#define _URCU_REF_H - -/* - * Userspace RCU - Reference counting - * - * Copyright (C) 2009 Novell Inc. - * Copyright (C) 2010 Mathieu Desnoyers - * - * Author: Jan Blunck - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License version 2.1 as - * published by the Free Software Foundation. - */ - -#include -#include - -struct urcu_ref { - long refcount; /* ATOMIC */ -}; - -static inline void urcu_ref_set(struct urcu_ref *ref, long val) -{ - uatomic_set(&ref->refcount, val); -} - -static inline void urcu_ref_init(struct urcu_ref *ref) -{ - urcu_ref_set(ref, 1); -} - -static inline void urcu_ref_get(struct urcu_ref *ref) -{ - uatomic_add(&ref->refcount, 1); -} - -static inline void urcu_ref_put(struct urcu_ref *ref, - void (*release)(struct urcu_ref *)) -{ - long res = uatomic_sub_return(&ref->refcount, 1); - assert (res >= 0); - if (res == 0) - release(ref); -} - -#endif /* _URCU_REF_H */