This commit is contained in:
azw 2023-08-19 00:01:57 +08:00
parent 4384bc7ac0
commit 8eb3db1113
2 changed files with 5 additions and 3 deletions

View File

@ -97,9 +97,10 @@ namespace f8
return awaiter->GetResult(); return awaiter->GetResult();
} }
std::shared_ptr<a8::Results> Coroutine::CoAwait(std::function<(std::shared_ptr<a8::Awaiter>)> cb) std::shared_ptr<a8::Results> Coroutine::CoAwait
(std::function<void (std::shared_ptr<a8::Awaiter>)> cb)
{ {
return CoAwait(std::make_shared<a8::CbPromise>(cb));
} }
void Coroutine::Attach() void Coroutine::Attach()

View File

@ -19,7 +19,8 @@ namespace f8
void CoResume(); void CoResume();
void CoYield(); void CoYield();
std::shared_ptr<a8::Results> CoAwait(std::shared_ptr<a8::Awaiter> awaiter); std::shared_ptr<a8::Results> CoAwait(std::shared_ptr<a8::Awaiter> awaiter);
std::shared_ptr<a8::Results> CoAwait(std::function<(std::shared_ptr<a8::Awaiter>)> cb); std::shared_ptr<a8::Results> CoAwait
(std::function<void (std::shared_ptr<a8::Awaiter>)> cb);
std::shared_ptr<a8::Awaiter> Sleep(long long time); std::shared_ptr<a8::Awaiter> Sleep(long long time);
private: private: