Thread safety in assertions is no longer experimental

This commit is contained in:
Martin Hořeňovský
2025-12-28 21:02:50 +01:00
parent eb3811c555
commit 970ec144f5
8 changed files with 21 additions and 17 deletions
+8 -4
View File
@@ -17,7 +17,7 @@
[Disabling deprecation warnings](#disabling-deprecation-warnings)<br>
[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<br>
[Static analysis support](#static-analysis-support)<br>
[Experimental thread safety](#experimental-thread-safety)<br>
[Thread safety in assertions (and messages)](#thread-safety-in-assertions-and-messages)<br>
Catch2 is designed to "just work" as much as possible, and most of the
configuration options below are changed automatically during compilation,
@@ -316,17 +316,21 @@ no backwards compatibility guarantees._
are not meant to be runnable, only "scannable".
## Experimental thread safety
<a id="experimental-thread-safety"></a>
## Thread safety in assertions (and messages)
> Introduced in Catch2 3.9.0
> Made non-experimental in Catch2 vX.Y.Z
Catch2 can optionally support thread-safe assertions, that means, multiple
user-spawned threads can use the assertion macros at the same time. Due
to the performance cost this imposes even on single-threaded usage, Catch2
defaults to non-thread-safe assertions.
CATCH_CONFIG_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS // enables thread safe assertions
CATCH_CONFIG_NO_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS // force-disables thread safe assertions
CATCH_CONFIG_THREAD_SAFE_ASSERTIONS // enables thread safe assertions
CATCH_CONFIG_NO_THREAD_SAFE_ASSERTIONS // force-disables thread safe assertions
See [the documentation on thread safety in Catch2](thread-safety.md#top)
for details on which macros are safe and other notes.
+1 -1
View File
@@ -20,7 +20,7 @@ test case macros is not thread-safe. The way sections define paths through
the test is incompatible with user spawning threads arbitrarily, so this
limitation is here to stay.
**Important: thread safety in Catch2 is [opt-in](configuration.md#experimental-thread-safety)**
**Important: thread safety in Catch2 is [opt-in](configuration.md#thread-safety)**
## Using assertion macros from spawned threads