diff --git a/server/robotserver/coroutine.cc b/server/robotserver/coroutine.cc index d9bc59c2..f33805af 100644 --- a/server/robotserver/coroutine.cc +++ b/server/robotserver/coroutine.cc @@ -135,7 +135,11 @@ void TimerPromise::DoAwait() [self] (int event, const a8::Args* args) mutable { if (event == a8::TIMER_EXEC_EVENT) { - + for (auto notifyer : self->notifyers_) { + if (!notifyer.expired()) { + notifyer.lock()->DoResume(); + } + } } }); } diff --git a/server/robotserver/coroutine.h b/server/robotserver/coroutine.h index 6cc9dc2e..a9a8d74e 100644 --- a/server/robotserver/coroutine.h +++ b/server/robotserver/coroutine.h @@ -32,11 +32,12 @@ class Awaiter : public std::enable_shared_from_this return done_; } + virtual void DoResume() {}; + protected: std::list> notifyers_; void Await(std::shared_ptr notifyer); virtual void DoAwait() = 0; - virtual void DoResume() {}; private: bool done_ = false;