framework/inc/helper/wakeupthread.hxx | 3 +++ framework/source/helper/wakeupthread.cxx | 17 +++++++++++++++++ 2 files changed, 20 insertions(+)
New commits: commit 78090581d246cd391d99575680b5b8f8d9de7840 Author: Caolán McNamara <[email protected]> AuthorDate: Sun Jul 28 14:07:49 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Jul 28 16:35:14 2024 +0200 restore WakeUpThread::joinThread removed with: commit 4aa2cc878dae3b34b16ccacd9358fda5e6d6a197 loplugin:unusedmethods Change-Id: Ie6006defdfdab23aef0fa9d9b66b125862b760f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171139 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/framework/inc/helper/wakeupthread.hxx b/framework/inc/helper/wakeupthread.hxx index 962f4b724fa2..b25a933dc8c8 100644 --- a/framework/inc/helper/wakeupthread.hxx +++ b/framework/inc/helper/wakeupthread.hxx @@ -39,6 +39,9 @@ class WakeUpThread final public: WakeUpThread(css::uno::Reference<css::util::XUpdatable> const& updatable); void stop(); + + static void joinThread(); + static void startThread(); }; } diff --git a/framework/source/helper/wakeupthread.cxx b/framework/source/helper/wakeupthread.cxx index 9a9fc37f7442..63d52a82da76 100644 --- a/framework/source/helper/wakeupthread.cxx +++ b/framework/source/helper/wakeupthread.cxx @@ -88,6 +88,13 @@ public: } } + static void startThread() + { + std::unique_lock g(getMutex()); + if (!updatables.empty() && !wakeupThread) + wakeupThread = new SharedWakeUpThread(); + } + void stopWithLock(std::unique_lock<std::mutex>& g) { terminate = true; @@ -135,6 +142,12 @@ public: if (updatables.empty()) disposeThreadWithLock(g); } + + static void joinThread() + { + std::unique_lock g(getMutex()); + disposeThreadWithLock(g); + } }; rtl::Reference<SharedWakeUpThread> SharedWakeUpThread::wakeupThread; @@ -143,6 +156,8 @@ std::vector<css::uno::WeakReference<css::util::XUpdatable>> SharedWakeUpThread:: namespace framework { +/* static */ void WakeUpThread::startThread() { SharedWakeUpThread::startThread(); } + WakeUpThread::WakeUpThread(css::uno::Reference<css::util::XUpdatable> const& up) : _updatable(up) { @@ -152,6 +167,8 @@ WakeUpThread::WakeUpThread(css::uno::Reference<css::util::XUpdatable> const& up) void WakeUpThread::stop() { SharedWakeUpThread::remove(_updatable); } +/* static */ void WakeUpThread::joinThread() { SharedWakeUpThread::joinThread(); } + } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
