Date: Sat, 27 Apr 2013 05:06:25 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249970 - head/sbin/hastd Message-ID: <201304270506.r3R56PaZ020012@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sat Apr 27 05:06:25 2013 New Revision: 249970 URL: http://svnweb.freebsd.org/changeset/base/249970 Log: 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. Modified: head/sbin/hastd/refcnt.h Modified: head/sbin/hastd/refcnt.h ============================================================================== --- head/sbin/hastd/refcnt.h Sat Apr 27 05:01:29 2013 (r249969) +++ head/sbin/hastd/refcnt.h Sat Apr 27 05:06:25 2013 (r249970) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304270506.r3R56PaZ020012>