mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
refs #605, make sure the main thread is not terminated
In unit test a reader was to started. Here it was happening the main thread was terminated accidentally
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f1ace9dde0
commit
f03f3ef224
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "worker.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
#include <future>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -91,11 +92,13 @@ namespace BlackMisc
|
||||
|
||||
void CContinuousWorker::quit() Q_DECL_NOEXCEPT
|
||||
{
|
||||
Q_ASSERT_X(!CThreadUtils::isApplicationThreadObjectThread(this), Q_FUNC_INFO, "Try to stop main thread");
|
||||
thread()->quit();
|
||||
}
|
||||
|
||||
void CContinuousWorker::quitAndWait() Q_DECL_NOEXCEPT
|
||||
{
|
||||
Q_ASSERT_X(!CThreadUtils::isApplicationThreadObjectThread(this), Q_FUNC_INFO, "Try to stop main thread");
|
||||
auto *ownThread = thread();
|
||||
quit();
|
||||
ownThread->wait();
|
||||
|
||||
Reference in New Issue
Block a user