Date: Sun, 30 Jun 2013 20:42:24 +0200 From: Tijl Coosemans <tijl@coosemans.org> To: Ed Schouten <ed@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r252411 - head/sys/sys Message-ID: <51D07C10.2000509@coosemans.org> In-Reply-To: <201306300854.r5U8sfYS018720@svn.freebsd.org> References: <201306300854.r5U8sfYS018720@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2ILACXFUOGTUTVWQQNEPG Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-06-30 10:54, Ed Schouten wrote: > Author: ed > Date: Sun Jun 30 08:54:41 2013 > New Revision: 252411 > URL: http://svnweb.freebsd.org/changeset/base/252411 >=20 > Log: > Make various fixes to <stdatomic.h>. > =20 > - According to the standard, memory_order is a type. Use a typedef. > =20 > - atomic_*_fence() and atomic_flag_*() are described by the standard = as > functions. Use inline functions to implement them. > =20 > - Only expose the atomic_*_explicit() functions in kernel space. We > should not use the short-hand functions, as they will always use > memory_order_seq_cst. >=20 > Modified: > head/sys/sys/stdatomic.h >=20 > Modified: head/sys/sys/stdatomic.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/stdatomic.h Sun Jun 30 08:36:19 2013 (r252410) > +++ head/sys/sys/stdatomic.h Sun Jun 30 08:54:41 2013 (r252411) > @@ -122,33 +122,44 @@ > * atomic operations. > */ > =20 > -enum memory_order { > +typedef enum { > memory_order_relaxed =3D __ATOMIC_RELAXED, > memory_order_consume =3D __ATOMIC_CONSUME, > memory_order_acquire =3D __ATOMIC_ACQUIRE, > memory_order_release =3D __ATOMIC_RELEASE, > memory_order_acq_rel =3D __ATOMIC_ACQ_REL, > memory_order_seq_cst =3D __ATOMIC_SEQ_CST > -}; > +} memory_order; > =20 > /* > * 7.17.4 Fences. > */ > =20 > +static __inline void > +atomic_thread_fence(memory_order __order __unused) I don't think you can use static inline. Standard library functions need to have external linkage, which means you have to implement them in libc.= What you can do is declare the function in the header and then define a macro implementation of it. > * 7.17.8 Atomic flag type and operations. > + * > + * XXX: Assume atomic_bool can be used as an atomic_flag. Is there som= e > + * kind of compiler built-in type we could use? I think you can just use unsigned char. Only the test-and-set and clear operations need to be atomic. Anything else (like copy-assignment) doesn't have to be atomic. Both clang and gcc have __atomic_test_and_set and __atomic_clear built-ins. ------enig2ILACXFUOGTUTVWQQNEPG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iF4EAREIAAYFAlHQfBQACgkQfoCS2CCgtiva1gD/e65/WqdD1WKrF0cKgoPZD8sx O7SuZ5m9QhfKSsGlvHYA/0RK+GIOHckP5uxeamAzkbQzBXDbxHTb8GpPgHS0kzOQ =LVim -----END PGP SIGNATURE----- ------enig2ILACXFUOGTUTVWQQNEPG--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51D07C10.2000509>