1
This commit is contained in:
parent
1d7e8a1087
commit
aaac15a155
@ -15,13 +15,18 @@ void CoMgr::Init()
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
co->CoYield();
|
||||
co->CoAwait(co->Sleep(1000));
|
||||
co->CoAwait(co->Sleep(3000));
|
||||
#if 0
|
||||
co->CoAwait(CreateCo
|
||||
(
|
||||
[i] (Coroutine* co)
|
||||
{
|
||||
a8::XPrintf("call subco A %d %d\n", {i, a8::XGetTickCount()});
|
||||
co->CoAwait(co->Sleep(3000));
|
||||
a8::XPrintf("call subco A1 %d %d\n", {i, a8::XGetTickCount()});
|
||||
//co->CoAwait(co->Sleep(3000));
|
||||
///co->Sleep(3000);
|
||||
a8::XPrintf("call subco A2 %d %d\n", {i, a8::XGetTickCount()});
|
||||
}).lock());
|
||||
#endif
|
||||
a8::XPrintf("call A %d %d\n", {i, a8::XGetTickCount()});
|
||||
}
|
||||
});
|
||||
|
@ -48,11 +48,7 @@ Coroutine::Coroutine(std::function<void(Coroutine*)> cb)
|
||||
CallEnter(sink);
|
||||
cb_(this);
|
||||
CallExit(sink);
|
||||
for (auto notifyer : notifyers_) {
|
||||
if (!notifyer.expired()) {
|
||||
notifyer.lock()->DoResume();
|
||||
}
|
||||
}
|
||||
DoDone();
|
||||
});
|
||||
}
|
||||
|
||||
@ -125,12 +121,6 @@ void Coroutine::CallExit(boost::coroutines2::coroutine<void>::push_type& sink)
|
||||
|
||||
void Coroutine::DoAwait()
|
||||
{
|
||||
done_ = true;
|
||||
for (auto notifyer : notifyers_) {
|
||||
if (!notifyer.expired()) {
|
||||
notifyer.lock()->DoResume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Coroutine::DoResume()
|
||||
|
Loading…
x
Reference in New Issue
Block a user