From 3764c06cce8e6850a99963792d57f39f931683f0 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 29 Jun 2013 20:13:39 +0000 Subject: Don't let hastd use C11 atomics. Due to possible concerns about the stability of C11 atomics, use our existing atomics API instead. Requested by: pjd --- sbin/hastd/refcnt.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sbin/hastd') 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 +#include #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); } -- cgit v1.1