You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/FITK_Kernel/FITKCore/FITKThreadTask.cpp

40 lines
905 B
C++

#include "FITKThreadTask.h"
#include "FITKThreadPool.h"
#include "FITKThreadPoolPrivate.h"
#include "FITKThreadTaskGroup.h"
namespace Core
{
FITKThreadTask::FITKThreadTask(QObject* parent /*= nullptr*/) : QObject(parent)
{
//设置自动删除线程结束自动delete
this->setAutoDelete(true);
}
FITKThreadTask::~FITKThreadTask()
{
auto ag = FITKThreadPool::getInstance()->getAgent();
if (ag == nullptr) return;
//从列表删除
ag->removeTask(this);
//发生信号
emit taskFinishedSig(this);
//从任务组移除
if (_taskGroup)
_taskGroup->removeThreadTask(this);
}
void FITKThreadTask::setResultMark(bool *success)
{
_resultMark = success;
}
void FITKThreadTask::setTaskGroup(FITKThreadTaskGroup* group)
{
_taskGroup = group;
}
}