Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

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.
Commit
d26f763180c081c8c10d17dee59b2b1139268220
Author
Martin Hořeňovský ·
Parents
5e4438242358

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_run_context.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

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() {