Esempio n. 1
0
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;
}
Esempio n. 2
0
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();
    }
}
Esempio n. 3
0
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();
    }
}