a422a9906fd787d1482210a5a61b6f3611b7f99c
5 * Userspace RCU - Reference counting
7 * Copyright (C) 2009 Novell Inc.
8 * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * Author: Jan Blunck <jblunck@suse.de>
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU Lesser General Public License version 2.1 as
14 * published by the Free Software Foundation.
18 #include <urcu/uatomic.h>
21 long refcount
; /* ATOMIC */
24 static inline void urcu_ref_set(struct urcu_ref
*ref
, long val
)
26 uatomic_set(&ref
->refcount
, val
);
29 static inline void urcu_ref_init(struct urcu_ref
*ref
)
34 static inline void urcu_ref_get(struct urcu_ref
*ref
)
36 uatomic_add(&ref
->refcount
, 1);
39 static inline void urcu_ref_put(struct urcu_ref
*ref
,
40 void (*release
)(struct urcu_ref
*))
42 long res
= uatomic_sub_return(&ref
->refcount
, 1);
48 #endif /* _URCU_REF_H */
This page took 0.033108 seconds and 3 git commands to generate.