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
|
[self] (int event, const a8::Args* args) mutable
|
||||||
{
|
{
|
||||||
if (event == a8::TIMER_EXEC_EVENT) {
|
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_;
|
return done_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void DoResume() {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list<std::weak_ptr<Awaiter>> notifyers_;
|
std::list<std::weak_ptr<Awaiter>> notifyers_;
|
||||||
void Await(std::shared_ptr<Awaiter> notifyer);
|
void Await(std::shared_ptr<Awaiter> notifyer);
|
||||||
virtual void DoAwait() = 0;
|
virtual void DoAwait() = 0;
|
||||||
virtual void DoResume() {};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool done_ = false;
|
bool done_ = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user