aboutsummaryrefslogtreecommitdiffstats
path: root/gui/ice40/worker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gui/ice40/worker.cc')
-rw-r--r--gui/ice40/worker.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc
index 4b101e7e..3854c67f 100644
--- a/gui/ice40/worker.cc
+++ b/gui/ice40/worker.cc
@@ -22,6 +22,9 @@ Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx)
parent->clearTerminate();
throw WorkerInterruptionRequested();
}
+ while (parent->isPaused()){
+ QThread::sleep(1);
+ }
};
}
@@ -49,7 +52,7 @@ void Worker::parsejson(const std::string &filename)
}
}
-TaskManager::TaskManager(Context *ctx) : toTerminate(false)
+TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
{
Worker *worker = new Worker(ctx, this);
worker->moveToThread(&workerThread);
@@ -85,4 +88,21 @@ void TaskManager::clearTerminate()
{
QMutexLocker locker(&mutex);
toTerminate = false;
+}
+
+void TaskManager::pause_thread()
+{
+ QMutexLocker locker(&mutex);
+ toPause = true;
+}
+
+void TaskManager::continue_thread()
+{
+ QMutexLocker locker(&mutex);
+ toPause = false;
+}
+bool TaskManager::isPaused()
+{
+ QMutexLocker locker(&mutex);
+ return toPause;
} \ No newline at end of file