X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Furcu_ref.h;fp=urcu%2Furcu_ref.h;h=0000000000000000000000000000000000000000;hp=a422a9906fd787d1482210a5a61b6f3611b7f99c;hb=f9bf6d545e9e4801bec75043d716f9810ca1024d;hpb=a2e7bf9ce5de5113c7f59c380b0087e291cd603d 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 */