feat(Tasks): add ConcurrentTask::clear to allow re-using tasks
This way old runs won't pile up in the internal DSs Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
4f1ea712da
commit
dd578354c4
@ -73,6 +73,22 @@ bool ConcurrentTask::abort()
|
|||||||
return suceedeed;
|
return suceedeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConcurrentTask::clear()
|
||||||
|
{
|
||||||
|
Q_ASSERT(!isRunning());
|
||||||
|
|
||||||
|
m_done.clear();
|
||||||
|
m_failed.clear();
|
||||||
|
m_queue.clear();
|
||||||
|
|
||||||
|
m_aborted = false;
|
||||||
|
|
||||||
|
m_progress = 0;
|
||||||
|
m_stepProgress = 0;
|
||||||
|
|
||||||
|
m_total_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void ConcurrentTask::startNext()
|
void ConcurrentTask::startNext()
|
||||||
{
|
{
|
||||||
if (m_aborted || m_doing.count() > m_total_max_size)
|
if (m_aborted || m_doing.count() > m_total_max_size)
|
||||||
|
@ -24,6 +24,11 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
bool abort() override;
|
bool abort() override;
|
||||||
|
|
||||||
|
/** Resets the internal state of the task.
|
||||||
|
* This allows the same task to be re-used.
|
||||||
|
*/
|
||||||
|
void clear();
|
||||||
|
|
||||||
protected
|
protected
|
||||||
slots:
|
slots:
|
||||||
void executeTask() override;
|
void executeTask() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user