1
This commit is contained in:
parent
15ea46ca30
commit
e1e32e2800
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -32,11 +32,12 @@ class Awaiter : public std::enable_shared_from_this<Awaiter>
|
||||
return done_;
|
||||
}
|
||||
|
||||
virtual void DoResume() {};
|
||||
|
||||
protected:
|
||||
std::list<std::weak_ptr<Awaiter>> notifyers_;
|
||||
void Await(std::shared_ptr<Awaiter> notifyer);
|
||||
virtual void DoAwait() = 0;
|
||||
virtual void DoResume() {};
|
||||
|
||||
private:
|
||||
bool done_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user