From e9a7eaa2761b3b0bc83f73ee92ff0da26e55d795 Mon Sep 17 00:00:00 2001 From: peri4 Date: Thu, 10 Nov 2022 15:03:51 +0300 Subject: [PATCH] fixes --- libs/main/thread/pitimer.cpp | 11 +++++++---- utils/system_daemon/daemon.cpp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/main/thread/pitimer.cpp b/libs/main/thread/pitimer.cpp index a06889f2..71675174 100644 --- a/libs/main/thread/pitimer.cpp +++ b/libs/main/thread/pitimer.cpp @@ -279,7 +279,7 @@ bool _PITimerImp_Thread::startTimer(double interval_ms) { bool _PITimerImp_Thread::stopTimer(bool wait) { thread_.stop(); event.notifyAll(); - if (wait) return thread_.waitForFinish(); + thread_.waitForFinish(); // if (wait) // if (!thread_.waitForFinish(10)) // if (thread_.isRunning()) @@ -368,9 +368,12 @@ void _PITimerImp_Thread::adjustTimes() { bool _PITimerImp_Thread::smallWait(int ms) { - thread_.mutex().lock(); - event.waitFor(thread_.mutex(), ms); - thread_.mutex().unlock(); + if (thread_.isStopping()) return false; + if (ms > 0) { + thread_.mutex().lock(); + event.waitFor(thread_.mutex(), ms); + thread_.mutex().unlock(); + } return !thread_.isStopping(); } diff --git a/utils/system_daemon/daemon.cpp b/utils/system_daemon/daemon.cpp index cfec7e4a..ec51c764 100644 --- a/utils/system_daemon/daemon.cpp +++ b/utils/system_daemon/daemon.cpp @@ -41,7 +41,6 @@ void Daemon::Remote::shellClose() { if (!term) return; piCoutObj << "shell close"; term_timer.stop(); - term_timer.waitForFinish(1000); term->destroy(); delete term; term = 0; @@ -331,6 +330,7 @@ Daemon::~Daemon() { delete r; } remotes.clear(); + delete _self; }