本文整理汇总了C++中ProcessId::incSuspendedCounter方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessId::incSuspendedCounter方法的具体用法?C++ ProcessId::incSuspendedCounter怎么用?C++ ProcessId::incSuspendedCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessId
的用法示例。
在下文中一共展示了ProcessId::incSuspendedCounter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventSuspend
int32_t OSSim::eventSuspend(Pid_t cpid, Pid_t pid)
{
LOG("OSSim::suspend(%d) Received from pid %d",pid,cpid);
ProcessId *proc = ProcessId::getProcessId(pid);
if( proc == 0 ) {
LOG("OSSim::suspend(%d) non existing process???", pid);
return 0;
}
// Increment the suspend counter
proc->incSuspendedCounter();
// Check if process already suspended
if(proc->getState()==SuspendedState) {
I(0);
LOG("OSSim::suspend(%d) already suspended (recursive=%d)"
, pid, proc->getSuspendedCounter());
return 0;
}
// The process should be ready or running
I((proc->getState()==ReadyState)||(proc->getState()==RunningState));
// Need to suspend only if suspended counter is positive
if(proc->getSuspendedCounter()>0) {
// The process is no longer runnable
cpus.makeNonRunnable(proc);
// Set the state to SuspendedState
proc->setState(SuspendedState);
} else {
I(0);
LOG("OSSim::suspend(%d,%d) OOO suspend/resume (%d)", cpid, pid, proc->getSuspendedCounter());
}
return 1;
}