当前位置: 首页>>代码示例>>C++>>正文


C++ Pointer::SetProgressMonitor方法代码示例

本文整理汇总了C++中internaljob::Pointer::SetProgressMonitor方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetProgressMonitor方法的具体用法?C++ Pointer::SetProgressMonitor怎么用?C++ Pointer::SetProgressMonitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在internaljob::Pointer的用法示例。


在下文中一共展示了Pointer::SetProgressMonitor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EndJob

void JobManager::EndJob(InternalJob::Pointer ptr_job, IStatus::Pointer result, bool notify)
{
  Poco::Timestamp::TimeDiff rescheduleDelay(InternalJob::T_NONE);
  {
    Poco::ScopedLock<Poco::Mutex> lock ( m_mutex);

    //  if the job is finishing asynchronously, there is nothing more to do for now
    if (result == Job::ASYNC_FINISH)
      return;

    //if job is not known then it cannot be done
    if (ptr_job->GetState() == Job::NONE)
       return;
    ptr_job->SetResult(result);
    ptr_job->SetProgressMonitor(IProgressMonitor::Pointer(nullptr));
    ptr_job->SetThread(nullptr);
    rescheduleDelay = ptr_job->GetStartTime().epochMicroseconds();
    InternalJob::Pointer sptr_job(ptr_job);
    ChangeState(sptr_job, Job::NONE);
  }

  //notify listeners outside sync block
  bool reschedule = m_active && rescheduleDelay > InternalJob::T_NONE && ptr_job->ShouldSchedule();
  if (notify)
    m_JobListeners.Done(ptr_job.Cast<Job>(), result, reschedule);
  //reschedule the job if requested and we are still active
  if (reschedule)
    Schedule(ptr_job, rescheduleDelay, reschedule);
}
开发者ID:151706061,项目名称:MITK,代码行数:29,代码来源:berryJobManager.cpp

示例2: RunNow

bool JobManager::RunNow(InternalJob::Pointer sptr_job)
{
  {
    Poco::ScopedLock<Poco::Mutex> lockMe (m_mutex);

    //cannot start if there is a conflicting job
    if (FindBlockingJob(sptr_job) != 0)
    return false;
    ChangeState(sptr_job, Job::RUNNING);
    sptr_job->SetProgressMonitor(IProgressMonitor::Pointer(new NullProgressMonitor()));
    sptr_job->Run(IProgressMonitor::Pointer(nullptr));
  }
  return true;
}
开发者ID:151706061,项目名称:MITK,代码行数:14,代码来源:berryJobManager.cpp

示例3: 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;
}
开发者ID:151706061,项目名称:MITK,代码行数:42,代码来源:berryJobManager.cpp


注:本文中的internaljob::Pointer::SetProgressMonitor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。