Beispiel #1
0
int32_t OSSim::eventResume(Pid_t cpid, Pid_t pid)
{
    LOG("OSSim::resume(%d,%d)", cpid, pid);
    ProcessId *proc = ProcessId::getProcessId(pid);
    if( proc == 0 ) {
        LOG("OSSim::resume(%d,%d) non existing process???", cpid, pid);
        return 0;
    }
    // Decrement the suspend counter
    proc->decSuspendedCounter();
    // If process is in SuspendedState
    if(proc->getState()==SuspendedState) {
        // If the suspend count is not positive
        if(proc->getSuspendedCounter()<=0) {
            // Make the process runnable
            proc->setState(InvalidState);
            cpus.makeRunnable(proc);
        }
        return 1;
    } else {
        I(0);
        LOG("OSSim::resume(%d,%d) OOO suspend/resume (%d)", cpid, pid, proc->getSuspendedCounter());
    }
    return 0;
}