Date: Fri, 5 Apr 2019 10:00:41 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r345906 - stable/11/sys/sparc64/include Message-ID: <201904051000.x35A0fw3059854@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Apr 5 10:00:40 2019 New Revision: 345906 URL: https://svnweb.freebsd.org/changeset/base/345906 Log: MFC r336832: Implement atomic_swap_{32,64,int,long,ptr}(9). Modified: stable/11/sys/sparc64/include/atomic.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sparc64/include/atomic.h ============================================================================== --- stable/11/sys/sparc64/include/atomic.h Fri Apr 5 07:45:13 2019 (r345905) +++ stable/11/sys/sparc64/include/atomic.h Fri Apr 5 10:00:40 2019 (r345906) @@ -152,14 +152,15 @@ e; \ }) -#define atomic_st(p, v, sz) do { \ +#define atomic_st(p, v, sz) ({ \ itype(sz) e, r; \ for (e = *(volatile itype(sz) *)(p);; e = r) { \ r = atomic_cas((p), e, (v), sz); \ if (r == e) \ break; \ } \ -} while (0) + e; \ +}) #define atomic_st_acq(p, v, sz) do { \ atomic_st((p), (v), sz); \ @@ -308,6 +309,12 @@ static __inline void \ atomic_store_rel_ ## name(volatile ptype p, vtype v) \ { \ atomic_st_rel((p), (v), sz); \ +} \ + \ +static __inline vtype \ +atomic_swap_ ## name(volatile ptype p, vtype v) \ +{ \ + return ((vtype)atomic_st((p), (v), sz)); \ } static __inline void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904051000.x35A0fw3059854>