void CPUThread::Run() { if(IsRunning()) Stop(); if(IsPaused()) { Resume(); return; } #ifndef QT_UI wxGetApp().SendDbgCommand(DID_START_THREAD, this); #endif m_status = Running; SetPc(entry); InitStack(); InitRegs(); DoRun(); Emu.CheckStatus(); #ifndef QT_UI wxGetApp().SendDbgCommand(DID_STARTED_THREAD, this); #endif }
/*---------------------------------------------------------------------- | PLT_ThreadTask::Run +---------------------------------------------------------------------*/ void PLT_ThreadTask::Run() { // NPT_TimeStamp now; // NPT_System::GetCurrentTimeStamp(now); // NPT_System::SetRandomSeed(now.m_NanoSeconds); if (m_Delay) { NPT_TimeStamp start, now; NPT_System::GetCurrentTimeStamp(start); do { NPT_System::GetCurrentTimeStamp(now); if (now >= start + m_Delay) break; } while(!IsAborting(100)); } if (!IsAborting(0)) { DoInit(); DoRun(); } if (m_TaskManager) { m_TaskManager->RemoveTask(this); } }
/*---------------------------------------------------------------------- | PLT_ThreadTask::Run +---------------------------------------------------------------------*/ void PLT_ThreadTask::Run() { m_Started.SetValue(1); // wait before starting task if necessary if ((float)m_Delay > 0.f) { // more than 100ms, loop so we can abort it if ((float)m_Delay > 0.1f) { NPT_TimeStamp start, now; NPT_System::GetCurrentTimeStamp(start); do { NPT_System::GetCurrentTimeStamp(now); if (now >= start + m_Delay) break; } while (!IsAborting(100)); } else { NPT_System::Sleep(m_Delay); } } // loop if (!IsAborting(0)) { DoInit(); DoRun(); } // notify the Task Manager we're done // it will destroy us if m_AutoDestroy is true if (m_TaskManager) { m_TaskManager->RemoveTask(this); } else if (m_AutoDestroy) { // destroy ourselves otherwise delete this; } }
void DBWorker::RunBatch(int idbatches, char* modelfile, bool mip) { try { sql::PreparedStatement *PrepStmt; sql::ResultSet *res; PrepStmt = con->prepareStatement( "select bat_order, idobjectives from batch_elem where idbatches=? order by bat_order" ); PrepStmt->setInt(1,idbatches); res = PrepStmt->executeQuery(); delete PrepStmt; int idobjective; while(res->next()) { idobjective = res->getInt(2); DoRun(idobjective,modelfile,mip); } delete res; } catch (sql::SQLException &e) { SQLError(e); } }
void DBWorker::RunBatchOnMultipeModels(int idbatches, vector<string> modelfiles, bool mip) { try { sql::PreparedStatement *PrepStmt; sql::ResultSet *res; PrepStmt = con->prepareStatement( "select bat_order, idobjectives from batch_elem where idbatches=? order by bat_order" ); PrepStmt->setInt(1,idbatches); res = PrepStmt->executeQuery(); delete PrepStmt; int idobjective; while(res->next()) { idobjective = res->getInt(2); for (vector<string>::iterator it = modelfiles.begin() ; it != modelfiles.end(); ++it) { DoRun(idobjective,it->c_str(),mip); } } delete res; } catch (sql::SQLException &e) { SQLError(e); } }
void VProcess::Run() { VTask *mainTask = VTask::GetMain(); if (!testAssert( (mainTask != NULL) && mainTask->IsCurrent() && (mainTask->GetState() == TS_RUNNING) )) return; if (!fInitCalled) fInitOK = Init(); if (fInitOK) { vFlushErrors(); StartMessaging(); DoRun(); DoQuit(); mainTask->Kill(); StopMessaging(); } else { vThrowError(VE_CANNOT_INITIALIZE_APPLICATION, "VApplication::DoInit failed"); } }
int Run() { // event loops are not recursive, you need to create another loop! //wxCHECK_MSG( !IsInsideRun(), -1, wxT("can't reenter a message loop") ); // ProcessIdle() and ProcessEvents() below may throw so the code here should // be exception-safe, hence we must use local objects for all actions we // should undo wxEventLoopActivator activate(this); // We might be called again, after a previous call to ScheduleExit(), so // reset this flag. m_shouldExit = false; // Set this variable to true for the duration of this method. setInsideRun( true ); struct SET_FALSE { EVENT_LOOP* m_loop; SET_FALSE( EVENT_LOOP* aLoop ) : m_loop( aLoop ) {} ~SET_FALSE() { m_loop->setInsideRun( false ); } } t( this ); // Finally really run the loop. return DoRun(); }
int Process::Run() { if (target != NULL) { return target->Run(); } else { return DoRun(); } }
int SekRun(int cyc) { int did=0; did=DoRun(cyc); return did; }
void CServiceRunner::Run() { pthread_t t; pthread_create(&t,NULL,MonitorThread,this); DoRun(); m_exiting = true; pthread_join(t,NULL); }
// Execute all tests in this and added suites. // void Suite::do_run(Output* os, bool cont_after_fail) { _continue = cont_after_fail; _output = os; _output->suite_start(_tests.size(), _name); for_each(_tests.begin(), _tests.end(), ExecTests(*this)); _output->suite_end(_tests.size(), _name, total_time(false)); for_each(_suites.begin(), _suites.end(), DoRun(_output, _continue)); }
// enters a loop calling OnNextIteration(), Pending() and Dispatch() and // terminating when Exit() is called int wxCFEventLoop::Run() { // event loops are not recursive, you need to create another loop! wxCHECK_MSG( !IsRunning(), -1, wxT("can't reenter a message loop") ); // ProcessIdle() and ProcessEvents() below may throw so the code here should // be exception-safe, hence we must use local objects for all actions we // should undo wxEventLoopActivator activate(this); // we must ensure that OnExit() is called even if an exception is thrown // from inside ProcessEvents() but we must call it from Exit() in normal // situations because it is supposed to be called synchronously, // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or // something similar here) #if wxUSE_EXCEPTIONS for ( ;; ) { try { #endif // wxUSE_EXCEPTIONS DoRun(); #if wxUSE_EXCEPTIONS // exit the outer loop as well break; } catch ( ... ) { try { if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() ) { OnExit(); break; } //else: continue running the event loop } catch ( ... ) { // OnException() throwed, possibly rethrowing the same // exception again: very good, but we still need OnExit() to // be called OnExit(); throw; } } } #endif // wxUSE_EXCEPTIONS return m_exitcode; }
bool HouseKeeperTask::Run(void) { LOG(VB_GENERAL, LOG_INFO, QString("Running HouseKeeperTask '%1'.") .arg(m_dbTag)); bool res = DoRun(); if (!res) LOG(VB_GENERAL, LOG_INFO, QString("HouseKeeperTask '%1' Failed.") .arg(m_dbTag)); else LOG(VB_GENERAL, LOG_INFO, QString("HouseKeeperTask '%1' Finished Successfully.") .arg(m_dbTag)); return res; }
int RunTest(const char* pcszDllPath, int nParams, const char* params[]) { bool fOk = CheckArgs(nParams, params); if (!fOk) return 1; Runner runner; g_RunningArgs.nameModule = pcszDllPath; if (!runner.TryLoad()) return 2; return DoRun(runner); }
rage::eThreadState GtaThread::Run(uint32_t opsToExecute) { // set the current thread rage::scrThread* activeThread = rage::scrEngine::GetActiveThread(); rage::scrEngine::SetActiveThread(this); // invoke the running thing if we're not dead if (m_Context.State != rage::ThreadStateKilled) { DoRun(); } rage::scrEngine::SetActiveThread(activeThread); return m_Context.State; }
int RunTest2(void* pTestProject, int nParams, const char* params[]) { if (pTestProject == NULL) { ASSERT(false); return 2; } bool fOk = CheckArgs(nParams, params); if (!fOk) return 1; Runner runner; runner.SetProject((ITestProject*)pTestProject); return DoRun(runner); }
void* ManagedThread::Entry() { { wxCriticalSectionLocker lock(s_count_running_mutex); s_running++; } void* result = DoRun(); { wxCriticalSectionLocker lock(s_count_running_mutex); if (s_running > 0) s_running--; } return result; }
void CPUThread::Run() { if(!IsStopped()) Stop(); Reset(); SendDbgCommand(DID_START_THREAD, this); m_status = Running; SetPc(entry); InitStack(); InitRegs(); DoRun(); Emu.CheckStatus(); SendDbgCommand(DID_STARTED_THREAD, this); }
TInt E32Main() { TheTest.Title(); CTrapCleanup* tc = CTrapCleanup::New(); __UHEAP_MARK; DoRun(); __UHEAP_MARKEND; TheTest.End(); TheTest.Close(); delete tc; User::Heap().Check(); return KErrNone; }
void PPCThread::Run() { if(IsRunned()) Stop(); if(IsPaused()) { Resume(); return; } wxGetApp().SendDbgCommand(DID_START_THREAD, this); m_status = Runned; SetPc(entry); InitStack(); InitRegs(); DoRun(); Emu.CheckStatus(); wxGetApp().SendDbgCommand(DID_STARTED_THREAD, this); }
int wxEventLoopBase::Run() { // event loops are not recursive, you need to create another loop! wxCHECK_MSG( !IsInsideRun(), -1, wxT("can't reenter a message loop") ); // ProcessIdle() and ProcessEvents() below may throw so the code here should // be exception-safe, hence we must use local objects for all actions we // should undo wxEventLoopActivator activate(this); // We might be called again, after a previous call to ScheduleExit(), so // reset this flag. m_shouldExit = false; // Set this variable to true for the duration of this method. m_isInsideRun = true; wxON_BLOCK_EXIT_SET(m_isInsideRun, false); // Finally really run the loop. return DoRun(); }
// Execute all tests in this and added suites. // void Suite::do_run(Output* os, bool cont_after_fail) { _continue = cont_after_fail; _output = os; _output->suite_start(_tests.size(), _name); for_each(_tests.begin(), _tests.end(), ExecTests(*this)); _output->suite_end(_tests.size(), _name, total_time(false)); for_each(_suites.begin(), _suites.end(), DoRun(_output, _continue)); // FIXME Find a cleaner way Suites::const_iterator iter = _suites.begin(); while (iter != _suites.end()) { if (!(*iter)->_success) { _success = false; break; } iter++; } }
void CThreadTask::Run() { m_Started.SetValue(1); if ((float)m_Delay > 0.f) { // more than 100ms, loop so we can abort it if ((float)m_Delay > 0.1f) { TimeStamp start, now, stamp; HelperSystem::GetCurrentTimeStamp(start); do { HelperSystem::GetCurrentTimeStamp(now); stamp = start + m_Delay; if (now >= stamp) break; } while (!IsAborting(100)); } else { HelperSystem::Sleep(m_Delay); } } // loop if (!IsAborting(0)) { DoInit(); DoRun(); } if (m_Manager) m_Manager->RemoveTask(this); else if (m_AutoDestroy) delete this; }
void GpuRenderPass::Run() { if (!enabled) return; program->SetActive(); program->curtex = 0; for (std::vector<std::pair<std::string, Res<Texture> > >::iterator it = textures.begin(); it != textures.end(); ++it) { it->second->Bind(program, it->first); } for (std::vector<VarSetter *>::iterator it = setters.begin(); it != setters.end(); ++it) { (*it)->run(program); } DoRun(); for (;program->curtex > 0; ) { program->curtex--; glActiveTexture(GL_TEXTURE0+program->curtex); glBindTexture(GL_TEXTURE_2D, 0); } }
Bunch& TrackingSimulation::Continue() { return DoRun(false,false); }
void InterprocessServer::Run() { while(!IsCancelPending()) { DoRun(); } }
static unsigned ProgRun( bool step ) { prog_go_ret *ret; byte int_buff[3]; addr48_ptr addr; _DBG1(( "AccRunProg\n" )); ret = GetOutPtr( 0 ); if( step ) { Proc.eflags |= 0x100; ret->conditions = DoRun(); Proc.eflags &= ~0x100; } else if( WatchCount != 0 ) { if( SetDebugRegs() ) { ret->conditions = DoRun(); ClearDebugRegs(); if( ret->conditions & COND_TRACE ) { ret->conditions |= COND_WATCH; ret->conditions &= ~COND_TRACE; } } else { for( ;; ) { addr.segment = Proc.cs; addr.offset = Proc.eip; if( ReadMemory( &addr, int_buff, 3 ) == 3 && int_buff[0] == 0xcd ) { /* have to breakpoint across software interrupts because Intel doesn't know how to design chips */ addr.offset = Proc.eip + 2; int_buff[0] = 0xcc; WriteMemory( &addr, int_buff, 1 ); } else { Proc.eflags |= 0x100; int_buff[0] = 0; } ret->conditions = DoRun(); if( int_buff[0] != 0 ) { addr.offset = Proc.eip; WriteMemory( &addr, &int_buff[2], 1 ); } else { Proc.eflags &= ~0x100; } if( !(ret->conditions & (COND_TRACE|COND_BREAK)) ) break; if( CheckWatchPoints() ) { ret->conditions |= COND_WATCH; ret->conditions &= ~(COND_TRACE|COND_BREAK); break; } } } } else { ret->conditions = DoRun(); } ret->conditions |= COND_CONFIG; ret->program_counter.offset = Proc.eip; ret->program_counter.segment = Proc.cs; ret->stack_pointer.offset = Proc.esp; ret->stack_pointer.segment = Proc.ss; return( sizeof( *ret ) ); }
void RenderPass::Run() { if (!enabled) return; DoRun(); }
unsigned ExecProg( bool tracing, bool do_flip, bool want_wps ) { bool have_brk_at_ip; bool act_wps; bool first_time; mad_trace_how how; execute_state es; unsigned conditions; unsigned run_conditions; bool already_stopping; bool force_stop; if( !want_wps ) ++InCall; tracing = TraceStart( tracing ); WriteDbgRegs(); first_time = true; es = ES_NORMAL; run_conditions = 0; if( !HaveRemoteAsync() ) { DUIPlayDead( true ); } how = MTRH_STOP; for( ;; ) { switch( es ) { case ES_FORCE_BREAK: case ES_NORMAL: if( tracing ) { how = TraceHow( false ); } else { _SwitchOn( SW_EXECUTE_LONG ); how = MTRH_BREAK; } break; case ES_STEP_ONE: how = TraceHow( true ); break; } if( how == MTRH_STOP ) break; switch( how ) { case MTRH_BREAK: DbgUpdate( UP_CSIP_JUMPED ); _SwitchOn( SW_TOUCH_SCREEN_BUFF ); /* fall through */ case MTRH_SIMULATE: case MTRH_STEP: case MTRH_STEPBREAK: if( _IsOff( SW_TOUCH_SCREEN_BUFF ) ) break; /* fall through */ default: if( !(ScrnState & USR_SCRN_ACTIVE) && do_flip ) { DUIStop(); } _SwitchOff( SW_TOUCH_SCREEN_BUFF ); break; } if( first_time ) { /* got to be down here so that SW_EXECUTE_LONG is properly set */ SetThreadStates(); first_time = false; } have_brk_at_ip = InsertBPs( (es == ES_FORCE_BREAK) ); act_wps = UpdateWPs(); if( how == MTRH_BREAK ) { if( have_brk_at_ip ) { es = ES_STEP_ONE; RemoveBPs(); continue; /* back to top */ } if( act_wps && want_wps ) { InsertWPs(); } } SetMemBefore( tracing ); switch( how ) { case MTRH_SIMULATE: if( TraceSimulate() ) { conditions = COND_TRACE; break; } /* fall through */ case MTRH_STEP: /* only updates stack/execution */ conditions = DoRun( true ); break; default: /* only updates stack/execution */ conditions = DoRun( false ); break; } if( _IsOn( SW_EXECUTE_LONG ) ) { if( ScrnState & DBG_SCRN_ACTIVE ) { _SwitchOn( SW_MIGHT_HAVE_LOST_DISPLAY ); } _SwitchOff( SW_EXECUTE_LONG ); } SetMemAfter( tracing ); run_conditions &= ~COND_WATCH; run_conditions |= conditions; RemoveBPs(); if( conditions & COND_MESSAGE ) { if( !RecordMsgText( &conditions ) ) { conditions &= ~COND_MESSAGE; } } conditions = CheckBPs( conditions, run_conditions ); if( _IsOn( SW_BREAK_ON_DEBUG_MESSAGE ) && ( conditions & COND_MESSAGE ) ) { conditions |= COND_STOP; } if( HaveRemoteAsync() && (conditions & COND_THREAD ) ) { conditions |= COND_STOP; } if( how == MTRH_STEPBREAK && (conditions & COND_BREAK) && DbgTmpBrk.status.b.hit ) { conditions &= ~COND_BREAK; conditions |= COND_TRACE; } if( conditions & COND_LIBRARIES ) { already_stopping = ( conditions & COND_STOPPERS ) != 0; conditions &= ~COND_LIBRARIES; force_stop = false; if( AddLibInfo( already_stopping, &force_stop ) ) { if( force_stop || DLLMatch() ) { conditions |= COND_STOP | COND_LIBRARIES; } } ReMapPoints( NULL ); } if( conditions & COND_SECTIONS ) { SectTblRead( DbgRegs ); InvalidateTblCache(); } if( (es == ES_STEP_ONE) && (conditions & COND_TRACE) ) { conditions &= ~COND_TRACE; } if( tracing ) { conditions = TraceCheck( conditions ); } if( !(conditions & COND_STOPPERS) && TBreak() ) { conditions |= COND_USER; break; } if( conditions & COND_STOPPERS ) break; switch( es ) { case ES_STEP_ONE: es = ES_FORCE_BREAK; break; case ES_FORCE_BREAK: es = ES_NORMAL; break; } if( (run_conditions & COND_WATCH) && es == ES_NORMAL ) { /* We got a spurious watch point indication. Make the next instruction single step since we might be dealing with a control flow opcode on a machine without a T-bit (e.g. Alpha). */ es = ES_STEP_ONE; } } TraceStop( tracing ); DUIPlayDead( false ); SetProgState( run_conditions ); _SwitchOff( SW_KNOW_EMULATOR ); if( !want_wps ) --InCall; return( conditions ); }
static void GenerateCalEntries(int col) { int r; Token tok; char const *s; Parser p; /* Do some initialization first... */ ClearGlobalOmits(); DestroyOmitContexts(); DestroyVars(0); NumTriggered = 0; r=IncludeFile(InitialFile); if (r) { fprintf(ErrFp, "%s %s: %s\n", ErrMsg[E_ERR_READING], InitialFile, ErrMsg[r]); exit(1); } while(1) { r = ReadLine(); if (r == E_EOF) return; if (r) { Eprint("%s: %s", ErrMsg[E_ERR_READING], ErrMsg[r]); exit(1); } s = FindInitialToken(&tok, CurLine); /* Should we ignore it? */ if (NumIfs && tok.type != T_If && tok.type != T_Else && tok.type != T_EndIf && tok.type != T_IfTrig && ShouldIgnoreLine()) { /* DO NOTHING */ } else { /* Create a parser to parse the line */ CreateParser(s, &p); switch(tok.type) { case T_Empty: case T_Comment: break; case T_ErrMsg: r=DoErrMsg(&p); break; case T_Rem: r=DoCalRem(&p, col); break; case T_If: r=DoIf(&p); break; case T_IfTrig: r=DoIfTrig(&p); break; case T_Else: r=DoElse(&p); break; case T_EndIf: r=DoEndif(&p); break; case T_Include: r=DoInclude(&p); break; case T_Exit: DoExit(&p); break; case T_Set: r=DoSet(&p); break; case T_Fset: r=DoFset(&p); break; case T_UnSet: r=DoUnset(&p); break; case T_Clr: r=DoClear(&p); break; case T_Flush: r=DoFlush(&p); break; case T_Debug: break; /* IGNORE DEBUG CMD */ case T_Dumpvars: break; /* IGNORE DUMPVARS CMD */ case T_Banner: break; /* IGNORE BANNER CMD */ case T_Omit: r=DoOmit(&p); if (r == E_PARSE_AS_REM) { DestroyParser(&p); CreateParser(s, &p); r=DoCalRem(&p, col); } break; case T_Pop: r=PopOmitContext(&p); break; case T_Push: r=PushOmitContext(&p); break; case T_Preserve: r=DoPreserve(&p); break; case T_RemType: if (tok.val == RUN_TYPE) { r=DoRun(&p); break; } else { CreateParser(CurLine, &p); r=DoCalRem(&p, col); break; } /* If we don't recognize the command, do a REM by default */ /* Note: Since the parser hasn't been used yet, we don't */ /* need to destroy it here. */ default: CreateParser(CurLine, &p); r=DoCalRem(&p, col); break; } if (r && (!Hush || r != E_RUN_DISABLED)) Eprint("%s", ErrMsg[r]); /* Destroy the parser - free up resources it may be tying up */ DestroyParser(&p); } } }