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

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner/Process.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-14 00:56:32 +0300
committerLeitwolf112026-11-14 00:56:32 +0300
commit5ad02bccfcb925df02d1273901b6e248d477c5fa (patch)
treee8db06877788de36d3fd4166472c4511f0c0412a /src/Progmasoft/Runner/Process.cpp
parent826735e00bfac9967a7979eae5a42cb49eac851b (diff)
downloadcatch3-5ad02bccfcb925df02d1273901b6e248d477c5fa.tar.gz
Make the start lock a never-destroyed objectfeature/per-test-coverage
A function-local static std::mutex has an exit-time destructor, which the macOS build rejects with -Wexit-time-destructors. The lock is now allocated once and never destroyed, which also keeps it usable by a thread that starts a child while the process exits.
Diffstat (limited to 'src/Progmasoft/Runner/Process.cpp')
-rw-r--r--src/Progmasoft/Runner/Process.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Progmasoft/Runner/Process.cpp b/src/Progmasoft/Runner/Process.cpp
index 41fa87f1..e3b0997b 100644
--- a/src/Progmasoft/Runner/Process.cpp
+++ b/src/Progmasoft/Runner/Process.cpp
@@ -621,8 +621,10 @@ namespace Progmasoft::Catch3::Runner
std::mutex &
StartLock()
{
- static std::mutex lock;
- return lock;
+ // Never destroyed, so no exit-time destructor runs while a
+ // detached thread may still start a child.
+ static std::mutex *const lock = new std::mutex;
+ return *lock;
}
} // namespace