public void ReleaseLock(uint lockNo) { if (lockNo == 0 || lockNo > LockCount) { return; } var @lock = Locks[lockNo - 1]; if (@lock.Owner != CurrentProcess.Id) { return; } @lock.RefCount--; if (@lock.RefCount != 0) { return; } @lock.Owner = 0; @lock.RefCount = 0; var blockingProcess = DeviceReadQueue.Dequeue(@lock.Handle); if (blockingProcess == null) { return; } var pcb = blockingProcess.Process; AcquireLock(pcb, @lock); ReadyQueue.Enqueue(pcb); }
public void SignalEvent(uint eventNo) { if (eventNo == 0 || eventNo > EventCount) { return; } var ev = Events[eventNo - 1]; BlockingProcess blockingProcess; while ((blockingProcess = DeviceReadQueue.Dequeue(ev.Handle)) != null) { ReadyQueue.Enqueue(blockingProcess.Process); } }
private void TickSleepTimer() { DeviceId sleepTimer; if (!SleepTimer.Tick(out sleepTimer)) { return; } BlockingProcess wakingProcess; while ((wakingProcess = DeviceReadQueue.Dequeue(sleepTimer)) != null) { ReadyQueue.Enqueue(wakingProcess.Process); } }
private void ReadTerminal() { uint value; if (!InputDevice.Get(out value)) { return; } BlockingProcess wakingProcess; while ((wakingProcess = DeviceReadQueue.Dequeue(DeviceId.Terminal)) != null) { var process = wakingProcess.Process; process.Registers[wakingProcess.Argument] = value; ReadyQueue.Enqueue(process); } }