Exemplo n.º 1
0
Arquivo: app.cpp Projeto: jj4jj/dcpots
int App::start(){
    int  iret = 0;
    bool bret = 0;
    while (true){
		app_tick_update(impl_);
        if (impl_->stoping){ //need stop
            bret = on_stop();
            if (bret){
                break;
            }
            continue;
        }
        if (impl_->restarting){//need restart
            bret = on_restart();
            if (bret){
                break;
            }
            continue;
        }
        if (impl_->reloading){//need reload
            _app_reload_env(impl_);
            iret = on_reload();
            if (iret){
                GLOG_ERR("reload error ret :%d !", iret);
            }
            impl_->reloading = false;
        }
        //running
        if (impl_->stcp) { //one tick , one us ?
            iret += dctcp_poll(impl_->stcp, impl_->maxtptick, impl_->maxtptick);
        }
        iret = on_loop();
        if (iret == 0){
            on_idle();
        }
    }
    iret = impl_->shm_pool.stop();
    if (iret){
        GLOG_ERR("shm pool stop error ret:%d", iret);
    }
    return on_exit();
}
Exemplo n.º 2
0
		void open() {
			if (hQuery_ != NULL)
				throw pdh_exception("query is not null!");
			PDH::PDHFactory::get_impl()->add_listener(this);
			on_reload();
		}