void Tresenv::sim_stop() { disable_tracing = false; ::fflush(fout); simulation.callFinish(); flushLastLine(); checkFingerprint(); // call endRun() if (startrun_done) { try { endRun(); } catch (std::exception& e) { displayException(e); } } // delete network if (setupnetwork_done) { try { simulation.deleteNetwork(); } catch (std::exception& e) { displayException(e); } } shutdown(); }
void Tresenv::sim_step() { // implement graceful exit when Ctrl-C is hit during simulation. We want // to finish the current event, then normally exit via callFinish() etc // so that simulation results are not lost. installSignalHandler(); startClock(); sigint_received = false; disable_tracing = true; cSimpleModule *mod; try { mod = simulation.selectNextModule(); if (!mod) throw cTerminationException("scheduler interrupted while waiting"); // execute event simulation.doOneEvent(mod); printEventBanner(mod); checkTimeLimits(); if (sigint_received) throw cTerminationException("SIGINT or SIGTERM received, exiting"); } catch (std::exception& e) { disable_tracing = false; stoppedWithException(e); displayException(e); } disable_tracing = false; stopClock(); deinstallSignalHandler(); }
DefuzemeApplication::DefuzemeApplication(int &argc, char **argv) : QApplication(argc, argv) { qRegisterMetaType<Exception>("Exception"); connect(this, SIGNAL(forwardException(Exception)), SLOT(displayException(Exception))); }