本文整理汇总了C++中internaljob::Pointer::IsRunCanceled方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::IsRunCanceled方法的具体用法?C++ Pointer::IsRunCanceled怎么用?C++ Pointer::IsRunCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类internaljob::Pointer
的用法示例。
在下文中一共展示了Pointer::IsRunCanceled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cancel
bool JobManager::Cancel(InternalJob::Pointer sptr_job)
{
IProgressMonitor::Pointer sptr_progressMonitor(nullptr);
bool runCanceling = false;
{
Poco::ScopedLock<Poco::Mutex> mangerMutex (m_mutex);
switch (sptr_job->GetState())
{
case Job::NONE :
return true;
case Job::RUNNING :
//cannot cancel a job that has already started (as opposed to ABOUT_TO_RUN)
if (sptr_job->InternalGetState() == Job::RUNNING)
{
sptr_progressMonitor = sptr_job->GetProgressMonitor();
runCanceling = sptr_job->IsRunCanceled();
if(runCanceling)
sptr_job->SetRunCanceled(true);
break ;
}
//signal that the job should be canceled before it gets a chance to run
sptr_job->SetAboutToRunCanceled(true);
return false;
default :
ChangeState(sptr_job, Job::NONE);
}
}
//call monitor outside sync block
if (sptr_progressMonitor != 0)
{
if(runCanceling)
{
if (!sptr_progressMonitor->IsCanceled())
sptr_progressMonitor->SetCanceled(true);
sptr_job->Canceling();
}
return false;
}
//only notify listeners if the job was waiting or sleeping
m_JobListeners.Done(sptr_job.Cast<Job>(), Status::CANCEL_STATUS(BERRY_STATUS_LOC), false);
return true;
}