svn commit: r252386 - head/sbin/hastd
Ed Schouten
ed at FreeBSD.org
Sat Jun 29 20:13:39 UTC 2013
Author: ed
Date: Sat Jun 29 20:13:39 2013
New Revision: 252386
URL: http://svnweb.freebsd.org/changeset/base/252386
Log:
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
Modified:
head/sbin/hastd/refcnt.h
Modified: head/sbin/hastd/refcnt.h
==============================================================================
--- head/sbin/hastd/refcnt.h Sat Jun 29 19:57:57 2013 (r252385)
+++ head/sbin/hastd/refcnt.h Sat Jun 29 20:13:39 2013 (r252386)
@@ -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);
}
More information about the svn-src-all
mailing list