From 1d187706f2e15d257b68b70b7faec5f7cf585e83 Mon Sep 17 00:00:00 2001 From: Stephen Webb Date: Fri, 20 Dec 2024 22:28:51 +1100 Subject: [PATCH] Test hypothesis --- src/main/cpp/fileappender.cpp | 3 ++- src/main/cpp/filewatchdog.cpp | 2 +- src/main/cpp/threadutility.cpp | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp index b2a23e57a..e6d064f53 100644 --- a/src/main/cpp/fileappender.cpp +++ b/src/main/cpp/fileappender.cpp @@ -206,7 +206,8 @@ void FileAppender::activateOptionsInternal(Pool& p) } else if (0 == _priv->bufferedSeconds) { - ThreadUtility::instance()->removePeriodicTask(getName()); + if (auto p = _priv->taskManager.lock()) + p->value()->removePeriodicTask(getName()); } } } diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp index 3f74e1eb3..e7101bd47 100644 --- a/src/main/cpp/filewatchdog.cpp +++ b/src/main/cpp/filewatchdog.cpp @@ -136,8 +136,8 @@ void FileWatchdog::checkAndConfigure() void FileWatchdog::start() { - checkAndConfigure(); auto taskManager = ThreadUtility::instancePtr(); + checkAndConfigure(); if (!taskManager->value().hasPeriodicTask(m_priv->taskName)) { if (LogLog::isDebugEnabled()) diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp index 31a0c1f6e..4b0d71502 100644 --- a/src/main/cpp/threadutility.cpp +++ b/src/main/cpp/threadutility.cpp @@ -56,8 +56,10 @@ struct ThreadUtility::priv_data { } +#ifdef MSYS_UCRT_DOES_NOT_HANG_HERE ~priv_data() { stopThread(); } +#endif ThreadStartPre start_pre{nullptr}; ThreadStarted started{nullptr};