mirror of
https://github.com/oatpp/oatpp.git
synced 2025-02-11 17:20:52 +08:00
schedule coroutine to timer while waiting for IO
This commit is contained in:
parent
61276f9c89
commit
252a25a431
@ -80,11 +80,6 @@ void IOWorker::work() {
|
||||
|
||||
switch(action.getType()) {
|
||||
|
||||
case Action::TYPE_IO_WAIT:
|
||||
roundIteration = 0;
|
||||
m_queue.round();
|
||||
break;
|
||||
|
||||
case Action::TYPE_IO_REPEAT:
|
||||
++ roundIteration;
|
||||
if(roundIteration == 10) {
|
||||
@ -93,6 +88,20 @@ void IOWorker::work() {
|
||||
}
|
||||
break;
|
||||
|
||||
// case Action::TYPE_IO_WAIT:
|
||||
// roundIteration = 0;
|
||||
// m_queue.popFront();
|
||||
// setCoroutineScheduledAction(CP, std::move(action));
|
||||
// getCoroutineProcessor(CP)->pushOneTaskFromIO(CP);
|
||||
// break;
|
||||
|
||||
case Action::TYPE_IO_WAIT: // schedule for timer
|
||||
roundIteration = 0;
|
||||
m_queue.popFront();
|
||||
setCoroutineScheduledAction(CP, oatpp::async::Action::createWaitRepeatAction(0));
|
||||
getCoroutineProcessor(CP)->pushOneTaskFromIO(CP);
|
||||
break;
|
||||
|
||||
default:
|
||||
roundIteration = 0;
|
||||
m_queue.popFront();
|
||||
|
@ -76,12 +76,12 @@ void Processor::addCoroutine(AbstractCoroutine* coroutine) {
|
||||
|
||||
switch(action.m_type) {
|
||||
|
||||
case Action::TYPE_IO_WAIT:
|
||||
case Action::TYPE_IO_REPEAT:
|
||||
coroutine->_SCH_A = Action::clone(action);
|
||||
popIOTask(coroutine);
|
||||
break;
|
||||
|
||||
case Action::TYPE_IO_REPEAT:
|
||||
case Action::TYPE_IO_WAIT:
|
||||
coroutine->_SCH_A = Action::clone(action);
|
||||
popIOTask(coroutine);
|
||||
break;
|
||||
|
@ -81,9 +81,9 @@ void TimerWorker::work() {
|
||||
setCoroutineScheduledAction(curr, std::move(action));
|
||||
break;
|
||||
|
||||
// case Action::TYPE_IO_WAIT:
|
||||
// setCoroutineScheduledAction(curr, oatpp::async::Action::createWaitRepeatAction(0));
|
||||
// break;
|
||||
case Action::TYPE_IO_WAIT:
|
||||
setCoroutineScheduledAction(curr, oatpp::async::Action::createWaitRepeatAction(0));
|
||||
break;
|
||||
|
||||
default:
|
||||
m_queue.cutEntry(curr, prev);
|
||||
|
Loading…
Reference in New Issue
Block a user