mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
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>
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.