Jonathan Wakely 45477b791d libstdc++: Add platform wait functions for FreeBSD [PR120527]
This defines __platform_wait, __platform_notify, and
__platform_wait_until for FreeBSD, making use of the _umtx_op syscall.

The Linux versions of those functions only support 32-bit integers, but
the FreeBSD versions use the syscall for both 32-bit and 64-bit types,
as the _umtx_op supports both.

We also need to change __spin_impl because it currently assumes the
waitable at args._M_obj is always a __platform_wait_t. Because FreeBSD
supports waiting on both 32-bit and 64-bit integers, we need a
platform-specific function for loading a value from _M_obj.  This adds a
new __platform_load function, which does an atomic load of the right
size. The Linux definition just loads an int, but for FreeBSD it depends
on _M_obj_size. We also need a generic version of the function for
platforms without __platform_wait, because __spin_impl is always used,
even when the __waitable_state contains a condition_variable.

libstdc++-v3/ChangeLog:

	PR libstdc++/120527
	* include/bits/atomic_wait.h [__FreeBSD__] (__platform_wait_t):
	Define typedef.
	[__FreeBSD__] (__platform_wait_uses_type): Define variable
	template.
	* src/c++20/atomic.cc (__platform_load): New function.
	[__FreeBSD__] (_GLIBCXX_HAVE_PLATFORM_WAIT, __platform_wait)
	(__platform_notify, __platform_wait_until): Define.
	(__detail::__spin_impl): Use __platform_load.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-03-09 16:44:11 +00:00
2026-02-22 00:16:27 +00:00
2026-03-02 09:49:03 +00:00
2026-02-24 00:16:30 +00:00
2026-03-07 00:16:29 +00:00
2026-02-27 00:16:38 +00:00
2026-03-07 00:16:29 +00:00
2026-03-02 09:49:03 +00:00
2026-03-06 00:16:27 +00:00
2026-03-02 09:49:03 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%