public bool isResourceStarved() { if (resourceStarved) { previousState = currentState; currentState = EnumThreadState.WAITING; return(true); } return(false); }
public SimulatorThread(ThreadFlags flags) { ownerProcess = flags.ownerProcess; childThreads = flags.childThreads; controlBlock = flags.controlBlock; executionUnit = flags.executionUnit; currentState = flags.currentState; previousState = flags.previousState; threadPriority = flags.threadPriority; ownsSemaphore = flags.ownsSemaphore; waitingForSemaphore = flags.waitingForSemaphore; resourceStarved = flags.resourceStarved; allocatedResources = flags.allocatedResources; requestedResources = flags.requestedResources; terminated = flags.terminated; lotteryTickets = flags.lotteryTickets; }