2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-01-19 16:12:09 +00:00

700 Commits

Author SHA1 Message Date
Andrey Semashev
84dccb548a Updated SDM reference in comments. 2025-12-29 17:20:49 +03:00
Andrey Semashev
bf58085780 Replaced macos-13 with macos-15 in GitHub Actions.
The macos-13 image is retired, macos-15 is now available.
2025-12-13 20:07:57 +03:00
Andrey Semashev
8491f958de Added a release note for the thread_pause fix on Apple PowerPC. 2025-12-13 19:15:49 +03:00
Sergey Fedorov
3840be856e thread_pause: use correct assembler syntax on powerpc*-apple-darwin
Fixes: https://github.com/boostorg/atomic/issues/79
2025-12-13 19:03:26 +03:00
Andrey Semashev
23b53aebe6 Merge pull request #78 from Flamefire/patch-1
Fix required CMake version
boost-1.90.0.beta1 boost-1.90.0
2025-09-30 15:42:19 +03:00
Alexander Grund
66045fb0a6 Fix required CMake version
`cxx_std_11` requires CMake 3.8
2025-09-30 14:30:50 +02:00
Andrey Semashev
11537e688c Removed clang-15 and libc++ GHA CI job.
We already test libc++ with a more recent clang.
2025-08-26 15:44:42 +03:00
Andrey Semashev
870fbffe04 Downgrade FreeBSD to 14.3 to work around CI failures.
FreeBSD 15.0 is currently failing because of the image issues.

Refs: https://github.com/vmactions/freebsd-vm/issues/108
2025-08-26 03:44:00 +03:00
Andrey Semashev
8baebaddda Merge pull request #77 from Flamefire/test-link-update
Update Link to regression test matrix in README
2025-08-25 19:03:59 +03:00
Alexander Grund
94394a832e Update Link to regression test matrix in README 2025-08-25 17:26:08 +02:00
Andrey Semashev
8a6de6d93d Use a more unique string for type_traits config check.
This avoids the potential clash with another library that could make
a similar check for <type_traits> but require a different set of
type traits. b2 seems to use the string as part of the key in the
config cache, so if the two different config checks have a matching
description string it is unknown which check result is cached and used.
boost-1.89.0
2025-06-19 04:20:15 +03:00
Andrey Semashev
e57de610db Use a relative path to atomic-arch-config instead of import-search.
Using a relative path is more explicit and should avoid a potential
name clash in case if there appears a different b2 module with the same
name in a different search location.
2025-06-19 02:34:11 +03:00
Andrey Semashev
1464ef7c2a Fix b2 import search path for configure-time checks.
Added a missing import-search directive to config/Jamfile so that
atomic-arch-config.jam is found when configure-time checks are invoked
from tests. This allows us to enable the type_traits check for tests.
2025-06-18 20:32:30 +03:00
Andrey Semashev
8080f4c434 Change searched-lib to lib in the Jamfile.
Apparently, searched-lib was not supposed to be used in libraries,
and the simple lib target is the preferred way to declare external
libraries.

https://github.com/bfgroup/b2/issues/431#issuecomment-2985057673
2025-06-18 20:08:04 +03:00
Andrey Semashev
f3b61da9c0 Move cxx11_hdr_ratio requirement to from tests the library.
We no longer include <ratio> in tests, but we do include it in the
library headers.
2025-06-18 19:44:17 +03:00
Andrey Semashev
cbe50fe500 Restore compatibility with older gcc versions.
Added is_trivially_copyable and is_trivially_default_constructible type
traits that rely on the non-standard type traits available in libstdc++
from gcc 4.8 and 4.9.

Rather than requiring cxx11_hdr_type_traits in the library and test
requirements, use a more limited test that checks only the type traits
we use in Boost.Atomic.

Similarly, downgrade the requirement of C++ unrestricted unions to
unions with members that have non-trivial default constructors.

Remove the requirements of alignas and alignof, since those are not
mandatory for now.

Closes https://github.com/boostorg/atomic/issues/74.
2025-06-18 19:09:03 +03:00
Andrey Semashev
0a14751832 Nonessential. 2025-06-16 18:02:02 +03:00
Andrey Semashev
c408cc0e5d Shorter and more consistent output of the pthread_cond_clockwait check. 2025-06-14 20:33:03 +03:00
Andrey Semashev
fdc15d4d9b Fixed GHA config. 2025-06-13 02:43:20 +03:00
Andrey Semashev
583a894b0b Added new gcc and clang jobs to GitHub Actions. 2025-06-13 02:42:31 +03:00
Andrey Semashev
cea4afffc1 Added .gitignore for docs. 2025-06-13 01:30:11 +03:00
Andrey Semashev
f676a29106 Prefer C++11 constructs in the docs. 2025-06-13 00:24:20 +03:00
Andrey Semashev
ff2574cd03 Enable bitwise operations for enumerations.
This is a Boost.Atomic extension over std::atomic.

Bitwise operations can be useful if the enumeration is used to implement
a bit mask or a set of flags. Without these operations, users have to
manually perform conversions between the enum type and the underlying
type, which can be tedious.

There are caveats with enums with non-fixed underlying type, but the
convenience outweighs the potential pitfalls.
2025-06-13 00:24:13 +03:00
Andrey Semashev
1fa02d93f0 Removed BOOST_ATOMIC_NO_ATOMIC_FLAG_INIT macro definition.
Since the library now requires C++11, BOOST_ATOMIC_FLAG_INIT is always
supported.
2025-06-12 00:54:03 +03:00
Andrey Semashev
fc751f1db6 Retry notify_one_test if the second thread receives value2.
Occasionally, notify_one_test fails because the second thread receives
value2 instead of value3, even though the wakeup delay check passes.
This typically happens on one of the VM runners, so it is possible
there is some weird timing issue, when the thread gets woken up spuriously,
before the atomic value is updated, but the recorded wait time ends
up just above the expected waiting duration. Just retry the test
in this case.

Also use seq_cst in wait tests consistently instead of release on
stores and seq_cst on waits.
2025-06-11 04:36:52 +03:00
Andrey Semashev
1dbff0108a Added header-only dependencies to tests Jamfile. 2025-06-11 04:26:11 +03:00
Andrey Semashev
9ab7eb0c57 Added Linux and Windows GitHub Actions jobs on ARM. 2025-06-11 04:00:51 +03:00
Andrey Semashev
d2d8484b28 Fix MSVC __isb intrinsic declaration on AArch64. 2025-06-11 03:24:38 +03:00
Andrey Semashev
d03f8f7564 Deprecate support for Windows CE.
This platform has long been untested (if it ever was) and practically
unmaintained. The support will be removed in a future release.
2025-06-11 01:57:25 +03:00
Andrey Semashev
5a5121fa72 Fixed a typo in _WIN32_WCE macro name. 2025-06-11 01:56:16 +03:00
Andrey Semashev
2c0300f074 Switch to <cstdint> header. 2025-06-11 01:01:35 +03:00
Andrey Semashev
ab59271bdf Remove some of the pre-C++11 workarounds.
Replaced C++11 emulation macros with proper keywords, replaced typedefs
with using-style type aliases, removed type traits shims that are no
longer needed.
2025-06-11 01:00:52 +03:00
Andrey Semashev
d70a1d8ba2 Make memory_order unconditionally a C++11 scoped enum. 2025-06-10 00:18:37 +03:00
Andrey Semashev
37c2b67324 Added support for MSVC ARM64EC target.
ARM64EC is similar to ARM64 in that the binary will run natively on
ARM64 CPUs and therefore supports all ARM64 intrinsics. The difference
is that it also supports AMD64 intrinsics (and therefore defines _M_AMD64
and _M_X64), which will be emulated by an implicitly linked library.
ARM64EC also changes ABI compared to ARM64, but it doesn't affect
Boost.Atomic.

Changed predefined macro checks in order to use msvc_arm backend for
ARM64EC instead of msvc_x86. The benefit is that msvc_arm uses memory
order-aware intrinsics instead of the full-fence ones on x86. The
downside is that 128-bit atomics won't be available (for now).

Also define BOOST_ATOMIC_DETAIL_INT_FP_ENDIAN_MATCH for ARM/ARM64
on Windows.
2025-06-09 02:22:34 +03:00
Andrey Semashev
73146ad97e Removed the check for _M_ARMT macro.
The macro is not documented in MSDN and it's not entirely clear when
it is defined (and, in particular, whether _M_ARM is also defined at
the same time). Remove it for now, until there appears demand for
it and a knowledgeable user who knows what it means and when it is
defined.
2025-06-09 00:54:47 +03:00
Andrey Semashev
03eb376616 Renamed smt_pause to thread_pause.
Although smt_pause matches the equivalent global function on Solaris and
some BSD systems both in name and behavior, this naming clash may cause
confusion and ambiguities in users' code that imports boost::atomics
namespace into their scope and calls smt_pause unqualified. Better
avoid these issues and pick a different name.

Add a simple test for thread_pause, which only tests that the operation
compiles and executes.

Also include the recently added headers in the global atomic.hpp.
2025-06-08 23:19:36 +03:00
Andrey Semashev
d3940538d3 Expose pause() as smt_pause().
The smt_pause() operation may be useful in spin loops to release CPU
resources for use in simpling threads on SMT-capable CPUs.

Compared to the previous pause() implementation, added support for
PowerPC and Solaris and use isb instruction on AArch64, which seems
to be used in various open source projects instead of yield.
2025-06-08 20:08:57 +03:00
Andrey Semashev
8454d8a089 Replaced test_clock with std::chrono::steady_clock in tests.
This uses std::chrono::steady_clock universally in tests where monotonic
clock is needed. On Windows, hopefully this will resolve the time mismatches
between wakeups and externally measures times. Given that we use absolute
timeouts for sleeps, hopefully, this will also not reintroduce problems
that were originally worked around by test_clock.
2025-06-08 15:58:24 +03:00
Andrey Semashev
66db4447cf Switch windows-2019 GHA images to windows-2022.
windows-2019 is being deprecated and will be removed. This means msvc-14.0
and msvc-14.2 toolsets are no longer available.
2025-06-08 15:58:24 +03:00
Andrey Semashev
3b4c10be1f Suppress default constructor of the target type in bitwise_cast.
Since the default constructor may be non-trivial and throwing, we have
to suppress it in the memcpy-based implementation of bitwise_cast. Since
the type must be trivially copyable, initializing the object using memcpy
is a valid way of creating it, so there is no UB.

This is necessary for all atomic operations that involve bitwise_cast
internally to remain noexcept, as specified in the C++ standard.

Also removed remove_cv shim since we now require type_traits and the
shim is no longer used.
2025-06-08 15:58:24 +03:00
Andrey Semashev
280f16ea1f Added docs for timed waiting operations. 2025-06-08 15:58:18 +03:00
Andrey Semashev
3a6abd10c1 Added tests for timed waiting operations. 2025-06-08 14:50:34 +03:00
Andrey Semashev
b36b040f3f Removed chrono workarounds for older compilers. 2025-06-08 04:37:51 +03:00
Andrey Semashev
bbe9234f8f Use absolute timeouts for sleeping in wait test helpers.
This may improve the precision of timing of thread wakeups.
2025-06-08 04:37:51 +03:00
Andrey Semashev
39f8c3213d Use GetTickCount64 unconditionally in tests on Windows. 2025-06-08 04:37:51 +03:00
Andrey Semashev
81a68c592a Added timed waiting operations to atomic(_ref/_flag) frontends.
Also updated the frontends to unconditionally use some C++11 features.
Removed time_traits shims that are no longer used.
2025-06-08 04:37:51 +03:00
Andrey Semashev
aec4d77b5b Added timed waiting operations to the emulated backend. 2025-06-08 04:37:51 +03:00
Andrey Semashev
5991e99381 Added timed wait operations to lock pool.
Added a configure test for pthread_cond_clockwait presence. If it is
available, use it for timed waits with absolute timeouts on POSIX platforms.

Futex-based implementation has been improvved to use proper atomic operations
to access m_cond, which is needed to avoid races between the futex syscall and
our notifying operations. Also, check if m_cond has changed whil looping in
the waiting operations.
2025-06-08 04:37:51 +03:00
Andrey Semashev
023b23f15a Added timed waiting operations to the generic backend. 2025-06-08 04:37:51 +03:00
Andrey Semashev
37bad0b6d6 Added timed waiting operations to Windows backend. 2025-06-08 04:37:51 +03:00