mirror of
https://github.com/nim-lang/Nim.git
synced 2026-09-18 02:54:52 +00:00
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.
This commit is contained in:
@@ -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>".}
|
||||
|
||||
Reference in New Issue
Block a user