#include "PushFlowTask.h" #include "BS_Log.h" #include "TaskInfo.h" PushFlowTask::PushFlowTask(const int TaskID) { this->TaskID = TaskID; } void PushFlowTask::start() { this->Flag = true; this->Flag_t = true; const auto Info = TaskInfo::getData(TaskID); if (Info) { AllocatorInfo AllInfo; AllInfo.TaskID = Info->TaskID; AllInfo.Terms = Info->Terms.values(); taskAllocator.Init(AllInfo); bool F = taskAllocator.Start(); TaskInfo::thread_pool.AddTask(&PushFlowTask::run, this); } } void PushFlowTask::stop() { this->Flag = false; taskAllocator.Stop(); while (this->Flag_t){ CTL::Thread::SleepMS(1); } } void PushFlowTask::addBuffer(const CTL::ByteArray &buffer) { taskAllocator.AddBuffer(buffer); } void PushFlowTask::addTID(const int ID) { taskAllocator.AddTerm(ID,{}); } void PushFlowTask::removeTID(const int ID) { taskAllocator.RemoveTerm(ID,{}); } void PushFlowTask::run() { BS_Log::Log("PushFlowTask::run Start TaskID: {}",TaskID); while (Flag) { const auto task = TaskInfo::getData(TaskID); if (task) { task->BitstreamHeartbeat(); } sleep.SleepMillisecond(std::chrono::milliseconds(5 * 1000)); } this->Flag_t = false; BS_Log::Warning("PushFlowTask::run Stop TaskID: {}",TaskID); }