Exemple #1
0
ProcessSet::ptr ProcessMgr::filterExited(ProcessSet::ptr inSet) { 
  if(!inSet)
    return inSet;

  if(inSet->empty())
    return inSet;

  ProcessSet::ptr procs = ProcessSet::newProcessSet();
  // Filter out exited processes
  ProcessSet::iterator procIter = inSet->begin();
  for(; procIter != inSet->end(); procIter++) {
    Process::ptr process = *procIter;

    if(process->isTerminated() || process->isExited() || process->isCrashed() || process->isDetached()) {
      continue;
    }

    procs->insert(process);
  }
  
  return procs;
}
Exemple #2
0
DysectAPI::DysectErrorCode Backend::resumeApplication() {
  ProcessSet::ptr allProcs = ProcessMgr::getAllProcs();

  if(!allProcs) {
    return Err::warn(Error, "Procset not available");
  }

  // Processes might have exited before setup
  allProcs = ProcessMgr::filterExited(allProcs);

  if(!allProcs) 
    return OK;

  if(allProcs->empty())
    return OK;

  if(allProcs->continueProcs()) {
    return OK;
  } else {
    return Err::warn(Error, "Procset could not continue processes");
  }
}
Exemple #3
0
DysectAPI::DysectErrorCode Backend::pauseApplication() {
  ProcessSet::ptr allProcs = ProcessMgr::getAllProcs();

  if(!allProcs) {
    return DYSECTWARN(Error, "Procset not available");
  }

  // Processes might have exited before setup
  allProcs = ProcessMgr::filterExited(allProcs);

  if(!allProcs)
    return OK;

  if(allProcs->empty())
    return OK;

  if(allProcs->stopProcs()) {
    DYSECTLOG(true, "stop all processes");
    return OK;
  } else {
    return DYSECTWARN(Error, "Procset could not stop processes");
  }
}