diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-26 18:50:03 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-26 18:50:03 +0000 |
commit | 86c5962983c4e1f97eccfa8636ebe5bdc88599cc (patch) | |
tree | aa20f30dc112c0f53efa8a6821f2fd4bc16127b9 /src/libutil/ref.h | |
parent | ef3d454616a1b1bae06f035374a64fbde5bbbfff (diff) | |
download | rspamd-86c5962983c4e1f97eccfa8636ebe5bdc88599cc.tar.gz rspamd-86c5962983c4e1f97eccfa8636ebe5bdc88599cc.zip |
Use atomic ops if possible
Diffstat (limited to 'src/libutil/ref.h')
-rw-r--r-- | src/libutil/ref.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/ref.h b/src/libutil/ref.h index 18e2c3903..1ad7d24a1 100644 --- a/src/libutil/ref.h +++ b/src/libutil/ref.h @@ -55,13 +55,13 @@ typedef struct ref_entry_s { #ifdef HAVE_ATOMIC_BUILTINS #define REF_RETAIN(obj) do { \ if ((obj) != NULL) { \ - __sync_add_and_fetch (&(obj)->ref.refcount, 1); \ + __atomic_add_fetch (&(obj)->ref.refcount, 1, __ATOMIC_RELEASE); \ } \ } while (0) #define REF_RELEASE(obj) do { \ if ((obj) != NULL) { \ - unsigned int _rc_priv = __sync_sub_and_fetch (&(obj)->ref.refcount, 1); \ + unsigned int _rc_priv = __atomic_sub_fetch (&(obj)->ref.refcount, 1, __ATOMIC_ACQ_REL); \ if (_rc_priv == 0 && (obj)->ref.dtor) { \ (obj)->ref.dtor (obj); \ } \ |