void ExampleExecutor::main(){
    shouldStop=false;


    while (true){
        if (shouldStop) break;

//        boost::thread::sleep(boost::posix_time::milliseconds(1500));

        Instruction instr=getNextInstruction();
        if (instr.type==Instruction::STOP){
            return;
        }

        if (instr.type==Instruction::START){
            debug("Starting match timer");
            totalCounter=0;
            timers.push_back(new SleepTimer(this, SLEEP_TIMER, NULL, true));
        }else{
            CountdownCommand* cmd=(CountdownCommand*)instr.command;
            bool foundFinished=false;
            list<SleepTimer*>::iterator it=timers.begin();
            for(;it!=timers.end();++it){
                if ((*it)->isFinished()){
                    (*it)->start(cmd->getCountdownValue(), cmd);
                    foundFinished=true;
                }
            }
            if (!foundFinished){
                timers.push_back(new SleepTimer(this,cmd->getCountdownValue(), cmd));
            }
        }
    }
    debug("Stopping execution");
}
Esempio n. 2
0
llvm::Error EntryStage::execute(InstRef & /*unused */) {
  assert(CurrentInstruction && "There is no instruction to process!");
  if (llvm::Error Val = moveToTheNextStage(CurrentInstruction))
    return Val;

  // Move the program counter.
  CurrentInstruction.invalidate();
  getNextInstruction();
  return llvm::ErrorSuccess();
}
Esempio n. 3
0
llvm::Error EntryStage::cycleStart() {
  if (!CurrentInstruction)
    getNextInstruction();
  return llvm::ErrorSuccess();
}