diff --git a/framework/inc/helper/wakeupthread.hxx b/framework/inc/helper/wakeupthread.hxx index f9099180d03f..cdc8700a5266 100644 --- a/framework/inc/helper/wakeupthread.hxx +++ b/framework/inc/helper/wakeupthread.hxx @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include namespace com::sun::star::util @@ -37,9 +37,8 @@ namespace framework class WakeUpThread final : public salhelper::Thread { css::uno::WeakReference updatable_; - osl::Condition condition_; - - osl::Mutex mutex_; + std::condition_variable condition_; + std::mutex mutex_; bool terminate_; void execute() override; diff --git a/framework/source/helper/wakeupthread.cxx b/framework/source/helper/wakeupthread.cxx index 503f6707a010..556d59dbb581 100644 --- a/framework/source/helper/wakeupthread.cxx +++ b/framework/source/helper/wakeupthread.cxx @@ -25,13 +25,15 @@ #include #include +#include + +using namespace std::chrono_literals; void framework::WakeUpThread::execute() { for (;;) { - TimeValue t{0, 25000000}; // 25 msec - condition_.wait(&t); { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); + condition_.wait_for(g, 25ms, [this] { return terminate_; }); if (terminate_) { break; } @@ -50,10 +52,10 @@ framework::WakeUpThread::WakeUpThread( void framework::WakeUpThread::stop() { { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); terminate_ = true; } - condition_.set(); + condition_.notify_one(); join(); }