summaryrefslogtreecommitdiff
path: root/ui/progresstask.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-01-21 16:10:07 -0500
committerGlenn Smith <glenn@vector35.com>2022-01-21 16:10:07 -0500
commit5e59fcd0f441ebdc204d9816f7d88c7218ddb7ff (patch)
tree303d9204268e43b552a64d8b78ac937d2f81961c /ui/progresstask.h
parent81b82f44a2350144bb49c52f1b11a9cfc84da0cd (diff)
Reimplement progresstask with std::condition_variable
Diffstat (limited to 'ui/progresstask.h')
-rw-r--r--ui/progresstask.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/ui/progresstask.h b/ui/progresstask.h
index a291c439..009e2c67 100644
--- a/ui/progresstask.h
+++ b/ui/progresstask.h
@@ -88,13 +88,21 @@ class BINARYNINJAUIAPI ProgressTask: public QObject
{
Q_OBJECT
- std::atomic_bool m_canceled;
ProgressDialog* m_dialog;
std::function<void(std::function<bool(size_t, size_t)>)> m_func;
- QThread* m_thread;
+ std::thread m_thread;
+ std::mutex m_mutex;
+ std::condition_variable m_cv;
+ bool m_canceled;
+ bool m_finished;
std::exception_ptr m_exception;
+ /*!
+ Run the task function (called on the background thread)
+ */
+ void start();
+
public:
/*!
Construct a new progress task, which automatically starts running a given function
@@ -135,11 +143,6 @@ public:
*/
void setText(const QString& text);
-private Q_SLOTS:
- void start();
-
- void finish();
-
public Q_SLOTS:
/*!
Cancel the progress dialog