forked from Silverfish/proton-bridge
fix(GODT-2389): close bridge on exception and add max termination wait time.
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user