diff options
author | Martin Willi <martin@revosec.ch> | 2013-05-08 15:07:09 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-06-11 15:54:27 +0200 |
commit | 3160b92adb396c5445b2f5b16b496c6fb5cec5b0 (patch) | |
tree | 3db5b348f9bce1d84950ac38e3f4dcb85b3495ae /src/libstrongswan/utils/utils.h | |
parent | 37a60cad3cfbf9ce98b6c76564f419fe884a1d71 (diff) | |
download | strongswan-3160b92adb396c5445b2f5b16b496c6fb5cec5b0.tar.bz2 strongswan-3160b92adb396c5445b2f5b16b496c6fb5cec5b0.tar.xz |
utils: ref_get() returns the new value of the reference counter
This allows us to use ref_get() for getting unique values.
Diffstat (limited to 'src/libstrongswan/utils/utils.h')
-rw-r--r-- | src/libstrongswan/utils/utils.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h index ff1a007c1..8cc48513b 100644 --- a/src/libstrongswan/utils/utils.h +++ b/src/libstrongswan/utils/utils.h @@ -661,7 +661,7 @@ typedef volatile u_int refcount_t; #ifdef HAVE_GCC_ATOMIC_OPERATIONS -#define ref_get(ref) {__sync_fetch_and_add(ref, 1); } +#define ref_get(ref) __sync_add_and_fetch(ref, 1) #define ref_put(ref) (!__sync_sub_and_fetch(ref, 1)) #define cas_bool(ptr, oldval, newval) \ @@ -677,8 +677,9 @@ typedef volatile u_int refcount_t; * Increments the reference counter atomic. * * @param ref pointer to ref counter + * @return new value of ref */ -void ref_get(refcount_t *ref); +refcount_t ref_get(refcount_t *ref); /** * Put back a unused reference. |