summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-04-27 05:06:25 +0000
committered <ed@FreeBSD.org>2013-04-27 05:06:25 +0000
commita09c9f55503eb5b4686f83908992db66e59fe595 (patch)
tree7416b0b1812a359595c4d968e6d35c619d49825e
parente8028497402579e4a7f85d8714e9038ace9d44d2 (diff)
downloadFreeBSD-src-a09c9f55503eb5b4686f83908992db66e59fe595.zip
FreeBSD-src-a09c9f55503eb5b4686f83908992db66e59fe595.tar.gz
Partially revert my last change.
I forgot that I still had a locally applied patch to my copy of Clang that needs to be pushed in before we should use C11 atomics.
-rw-r--r--sbin/hastd/refcnt.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/hastd/refcnt.h b/sbin/hastd/refcnt.h
index 5e3fb34..1246043 100644
--- a/sbin/hastd/refcnt.h
+++ b/sbin/hastd/refcnt.h
@@ -32,24 +32,24 @@
#ifndef __REFCNT_H__
#define __REFCNT_H__
-#include <stdatomic.h>
+#include <machine/atomic.h>
#include "pjdlog.h"
-typedef atomic_uint refcnt_t;
+typedef unsigned int refcnt_t;
static __inline void
refcnt_init(refcnt_t *count, unsigned int v)
{
- atomic_init(count, v);
+ *count = v;
}
static __inline void
refcnt_acquire(refcnt_t *count)
{
- atomic_fetch_add_explicit(count, 1, memory_order_acquire);
+ atomic_add_acq_int(count, 1);
}
static __inline unsigned int
@@ -58,7 +58,7 @@ refcnt_release(refcnt_t *count)
unsigned int old;
/* XXX: Should this have a rel membar? */
- old = atomic_fetch_sub(count, 1);
+ old = atomic_fetchadd_int(count, -1);
PJDLOG_ASSERT(old > 0);
return (old - 1);
}
OpenPOWER on IntegriCloud