void ScheduleSave() { save_timer.expires_from_now(std::chrono::minutes(1)); save_timer.async_wait([this](const boost::system::error_code &ec){ if (ec) return; Save(); ScheduleSave(); }); }
void ScheduleExpire() { expire_timer.expires_from_now(std::chrono::minutes(5)); expire_timer.async_wait([this](const boost::system::error_code &ec){ if (ec) return; clients.Expire(expire_timer.expires_at() - std::chrono::minutes(10)); if (!clients.empty()) ScheduleExpire(); }); }
void print() { if (count_ < 500) { cout << count_ << endl; ++count_; timer_.expires_from_now(chrono::milliseconds(50)); timer_.async_wait(bind(&printer::print, this)); } else { cout << "Final count is " << count_ << endl; delete this; } }
void OnTimer(const boost::system::error_code &ec) { if (ec || !replay.Next()) { timer.get_io_service().stop(); return; } auto vario = replay.Basic().brutto_vario; printf("%2.1f\n", (double)vario); synthesiser.SetVario(vario); timer.expires_from_now(std::chrono::seconds(1)); Start(); }
void run() { timer_.expires_from_now(chrono::milliseconds(50)); timer_.async_wait(bind(&printer::print, this)); io_.run(); }