diff options
author | metagn <metagngn@gmail.com> | 2024-09-30 21:54:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 20:54:07 +0200 |
commit | b82ff5a87bfb19c7c6a2a7cbf8d860acdadbe877 (patch) | |
tree | a012468bc26d5858fd49aeb21ddb55f919ac3a01 /lib | |
parent | 2a48182288b1c6fbc01070e5e1ffb7653b3599e3 (diff) | |
download | Nim-b82ff5a87bfb19c7c6a2a7cbf8d860acdadbe877.tar.gz |
make C++ atomic opt in via -d:nimUseCppAtomics (#24209)
refs #24207 The `-d:nimUseCAtomics` flag added in #24207 is now inverted and made into `-d:nimUseCppAtomics`, which means C++ atomics are only enabled with the define. This flag is now also documented and tested.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/concurrency/atomics.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pure/concurrency/atomics.nim b/lib/pure/concurrency/atomics.nim index a3ef2f5f7..818f1b37a 100644 --- a/lib/pure/concurrency/atomics.nim +++ b/lib/pure/concurrency/atomics.nim @@ -10,6 +10,9 @@ ## Types and operations for atomic operations and lockless algorithms. ## ## Unstable API. +## +## By default, C++ uses C11 atomic primitives. To use C++ `std::atomic`, +## `-d:nimUseCppAtomics` can be defined. runnableExamples: # Atomic @@ -50,7 +53,7 @@ runnableExamples: flag.clear(moRelaxed) assert not flag.testAndSet -when (defined(cpp) and not defined(nimUseCAtomics)) or defined(nimdoc): +when (defined(cpp) and defined(nimUseCppAtomics)) or defined(nimdoc): # For the C++ backend, types and operations map directly to C++11 atomics. {.push, header: "<atomic>".} |