diff --git a/server/robotserver/comgr.cc b/server/robotserver/comgr.cc index 30a140a5..b3fcca21 100644 --- a/server/robotserver/comgr.cc +++ b/server/robotserver/comgr.cc @@ -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()}); } }); diff --git a/server/robotserver/coroutine.cc b/server/robotserver/coroutine.cc index f5f0ed33..11eb13a9 100644 --- a/server/robotserver/coroutine.cc +++ b/server/robotserver/coroutine.cc @@ -48,11 +48,7 @@ Coroutine::Coroutine(std::function 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::push_type& sink) void Coroutine::DoAwait() { - done_ = true; - for (auto notifyer : notifyers_) { - if (!notifyer.expired()) { - notifyer.lock()->DoResume(); - } - } } void Coroutine::DoResume()