Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal/catch_run_context.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-11-30 21:34:24 +0100
committerMartin Hořeňovský2025-12-01 10:44:31 +0100
commitd26f763180c081c8c10d17dee59b2b1139268220 (patch)
treef78340587b8f902330d9886afe8a25f0d984f01e /src/catch2/internal/catch_run_context.cpp
parent5e44382423585b99f33afd54c3c412c69ae2382f (diff)
downloadcatch3-d26f763180c081c8c10d17dee59b2b1139268220.tar.gz
Initialize ReusableStringStream cache before user threads can run
The initialization itself is thread unsafe, and as such we cannot allow it to be delayed until multiple user-spawned threads need it.
Diffstat (limited to 'src/catch2/internal/catch_run_context.cpp')
-rw-r--r--src/catch2/internal/catch_run_context.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 1ecc0644..3d72131d 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -210,6 +210,13 @@ namespace Catch {
{
getCurrentMutableContext().setResultCapture( this );
m_reporter->testRunStarting(m_runInfo);
+
+ // TODO: HACK!
+ // We need to make sure the underlying cache is initialized
+ // while we are guaranteed to be running in a single thread,
+ // because the initialization is not thread-safe.
+ ReusableStringStream rss;
+ (void)rss;
}
RunContext::~RunContext() {