void BenchmarkRunner::run(const String& _name, const String& _param) { mForcefulStop = false; mIOService->reset(); Benchmark* bm = mFactory.getConstructor(_name)( std::tr1::bind(&BenchmarkRunner::handleBenchmarkFinished, this), _param ); Thread bm_thread( std::tr1::bind(&BenchmarkRunner::benchmarkThread, this, bm) ); Network::IOTimerPtr timer = Network::IOTimer::create(mIOService); timer->wait( mTimeout, std::tr1::bind(&BenchmarkRunner::handleTimeout, this, bm) ); mIOService->run(); timer->cancel(); bm_thread.join(); delete bm; }
void Context::cleanup() { Network::IOTimerPtr timer = mKillTimer; if (timer) { timer->cancel(); mKillTimer.reset(); timer.reset(); mKillService->stop(); mKillThread->join(); Network::IOServiceFactory::destroyIOService(mKillService); mKillService = NULL; mKillThread.reset(); } }
void Context::cleanup() { Network::IOTimerPtr timer = mKillTimer; if (timer) { timer->cancel(); mKillTimer.reset(); timer.reset(); mKillService->stop(); mKillThread->join(); delete mKillService; mKillService = NULL; mKillThread.reset(); } }