fix(GODT-2389): close bridge on exception and add max termination wait time.

This commit is contained in:
Xavier Michelon
2023-02-22 19:39:24 +01:00
parent 89112baf96
commit 265af2d299
3 changed files with 12 additions and 10 deletions

View File

@ -84,7 +84,8 @@ void Overseer::releaseWorker() {
if (thread_) {
if (!thread_->isFinished()) {
thread_->quit();
thread_->wait();
if (!thread_->wait(maxTerminationWaitTimeMs))
thread_->terminate();
}
thread_->deleteLater();
thread_ = nullptr;

View File

@ -46,6 +46,9 @@ public slots:
void startWorker(bool autorelease) const; ///< Run the worker.
void releaseWorker(); ///< Delete the worker and its thread.
public: // static data members
static qint64 const maxTerminationWaitTimeMs { 10000 }; ///< The maximum wait time for the termination of a thread
public: // data members.
QThread *thread_ { nullptr }; ///< The thread.
Worker *worker_ { nullptr }; ///< The worker.