本文整理汇总了C++中internaljob::Pointer::IsAboutToRunCanceled方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::IsAboutToRunCanceled方法的具体用法?C++ Pointer::IsAboutToRunCanceled怎么用?C++ Pointer::IsAboutToRunCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类internaljob::Pointer
的用法示例。
在下文中一共展示了Pointer::IsAboutToRunCanceled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartJob
Job::Pointer JobManager::StartJob()
{
Job::Pointer job(nullptr);
while (true)
{
job = NextJob();
if (!job)
return Job::Pointer(nullptr);
//must perform this outside sync block because it is third party code
bool shouldRun = job->ShouldRun();
//check for listener veto
if (shouldRun)
m_JobListeners.AboutToRun(job);
//listeners may have canceled or put the job to sleep
bool endJob = false;
{
Poco::ScopedLock<Poco::Mutex> lock(m_mutex);
InternalJob::Pointer internal = job;
if (internal->InternalGetState() == InternalJob::ABOUT_TO_RUN)
{
if (shouldRun && !internal->IsAboutToRunCanceled())
{
internal->SetProgressMonitor(CreateMonitor(job));
//change from ABOUT_TO_RUN to RUNNING
internal->InternalSetState(Job::RUNNING);
break;
}
internal->SetAboutToRunCanceled(false);
endJob = true;
//fall through and end the job below
}
}
if (endJob)
{
//job has been vetoed or canceled, so mark it as done
EndJob(job,Status::CANCEL_STATUS(BERRY_STATUS_LOC), true);
continue;
}
}
m_JobListeners.Running(job);
return job;
}