Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto hb_interval = seconds(workers_.size());
- for (auto& worker : workers_) {
- SharedPtr<high_resolution_timer> hb_timer = std::make_shared<high_resolution_timer>(worker->GetIO(), hb_interval);
- SharedPtr<std::function<void(const boost::system::error_code&)> > cb = std::make_shared<std::function<void(const boost::system::error_code&)> >();
- *cb = [this, hb_timer, cb, hb_interval] (const boost::system::error_code& ec) {
- if (ec) {
- return;
- }
- hb_timer->expires_after(hb_interval);
- hb_timer->async_wait(*cb);
- ++hb_;
- };
- hb_timer->async_wait(*cb);
- hb_timers_.push_back(hb_timer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement