mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 00:30:26 +00:00
Goes further in ensuring safe shutdown.
Especially if no machine has been started.
This commit is contained in:
parent
4fdbe578cc
commit
4e83e80962
@ -25,6 +25,10 @@ class FunctionThread: public QThread {
|
||||
while(performerFlag.test_and_set());
|
||||
}
|
||||
|
||||
~FunctionThread() {
|
||||
stop();
|
||||
}
|
||||
|
||||
void run() override {
|
||||
// Gymnastics here: events posted directly to the QThread will occur on the thread
|
||||
// that created the QThread. To have events occur within a QThread, they have to be
|
||||
@ -35,9 +39,11 @@ class FunctionThread: public QThread {
|
||||
}
|
||||
|
||||
void stop() {
|
||||
performAsync([this] {
|
||||
this->quit();
|
||||
});
|
||||
if(isRunning()) {
|
||||
performAsync([this] {
|
||||
this->quit();
|
||||
});
|
||||
}
|
||||
wait();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,9 @@ void Timer::tick() {
|
||||
|
||||
Timer::~Timer() {
|
||||
thread.performAsync([this] {
|
||||
timer->stop();
|
||||
if(timer) {
|
||||
timer->stop();
|
||||
}
|
||||
});
|
||||
thread.stop();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user