1
This commit is contained in:
parent
fd1386e1be
commit
beed72f3a9
@ -64,12 +64,14 @@ std::shared_ptr<a8::Results> Coroutine::CoAwait(Awaiter& awaiter)
|
||||
std::shared_ptr<a8::Results> Coroutine::CoAwait(Awaiter* awaiter)
|
||||
{
|
||||
CoSuspend();
|
||||
#if 0
|
||||
awaiter->Await
|
||||
(
|
||||
[] ()
|
||||
{
|
||||
|
||||
});
|
||||
#endif
|
||||
CoYield();
|
||||
while (!awaiter->Done()) {
|
||||
CoYield();
|
||||
@ -99,8 +101,3 @@ void Coroutine::CallExit(boost::coroutines2::coroutine<void>::push_type& sink)
|
||||
{
|
||||
sink_ = nullptr;
|
||||
}
|
||||
|
||||
void Coroutine::Await(std::function<void()> cb)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace a8
|
||||
};
|
||||
}
|
||||
|
||||
class Awaiter
|
||||
class Awaiter : public std::enable_shared_from_this<Awaiter>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -34,7 +34,7 @@ class Awaiter
|
||||
|
||||
protected:
|
||||
|
||||
virtual void Await(std::function<void()> cb)
|
||||
virtual void Await(std::shared_ptr<Awaiter> parent)
|
||||
{
|
||||
|
||||
}
|
||||
@ -51,7 +51,7 @@ class Promise : public Awaiter
|
||||
|
||||
};
|
||||
|
||||
class Coroutine : public Awaiter, public std::enable_shared_from_this<Coroutine>
|
||||
class Coroutine : public Awaiter
|
||||
{
|
||||
public:
|
||||
~Coroutine();
|
||||
@ -71,8 +71,6 @@ class Coroutine : public Awaiter, public std::enable_shared_from_this<Coroutine>
|
||||
void CallEnter(boost::coroutines2::coroutine<void>::push_type& sink);
|
||||
void CallExit(boost::coroutines2::coroutine<void>::push_type& sink);
|
||||
|
||||
virtual void Await(std::function<void()> cb) override;
|
||||
|
||||
private:
|
||||
list_head co_entry_;
|
||||
list_head exec_entry_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user