void addOuterMostSeq(MissionSequencer seq) { ScjProcess process = ManagedSchedMethods.createScjProcess(seq); process.index = -2; MissionSequencer.missSeqProcess = process; outerMostSeqProcess = (ScjProcess) seq.process; pFrame.addProcess(process); }
void release(AperiodicEventHandler handler) { // see AperiodicEventHandler, where release is called ScjProcess process = (ScjProcess) handler.process; vm.ClockInterruptHandler.instance.disable(); if (process.state == ScjProcess.State.EXECUTING) {; // do nothing, - is already running } else if (process.state == ScjProcess.State.BLOCKED) { process.state = ScjProcess.State.READY; process.start(); pFrame.readyQueue.insert(process); } else {; // it is already ready } vm.ClockInterruptHandler.instance.enable(); vm.ClockInterruptHandler.instance.yield(); }
@IcecapCompileMe ScjProcess move() { if (current == ScjProcess.idleProcess) { pFrame.readyQueue.insert(current); } else { current.gotoNextState(pFrame); } // Move processes from sleepingQueue to readyQueue ScjProcess process = pFrame.sleepingQueue.minimum(); rtClock.getTime(now); while (process != null && process.next.compareTo(now) <= 0) { process.state = ScjProcess.State.READY; ScjProcess t = pFrame.sleepingQueue.extractMin(); // devices.Console.println("PrSch.move:sleep --> ready: " + t.index); pFrame.readyQueue.insert(t); // look at "next" process in sleeping queue with smallest // activationTime process = pFrame.sleepingQueue.minimum(); } // get next process from readyQueue ScjProcess nextProcess = pFrame.readyQueue.extractMax(); nextProcess.state = ScjProcess.State.EXECUTING; current = nextProcess; if (current == ScjProcess.idleProcess && pFrame.sleepingQueue.heapSize == 0 && pFrame.waitQueue.heapSize == 0 && pFrame.lockQueue.heapSize == 0) { // devices.Console.println("PrioritySch.move: " + current.getTarget()); // current.getTarget().cleanUp(); // HSO: is this call of cleanUp() necessary ? Then the // TCK-test does not work return null; } else { return nextProcess; } }
void moveToNext() { ScjProcess nextProcess = pFrame.readyQueue.extractMax(); nextProcess.state = ScjProcess.State.EXECUTING; current = nextProcess; // devices.Console.println("<<< From readyQueue to current: " + nextProcess.index); }