You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It will be good if we have a more performant built-in function for that; A function which returns the (boolean) fact "whether the coroutine is in "yieldable" mode or not" (which replaces the less-performing condition below):
if (Swoole\Coroutine::getBackTrace($cid1)[0]['function'] == 'yield') {
...
}
Or may be you can update co::resume() such that it resumes the yielded coroutine only when it is yieldable (in "yieldable" moden: when it is released from I/O and / or co::sleep() )
Thanks in advance.
Also, with due regards, i would like to present my disagreement with this response
I think co::yield() / co::resume() is a useful set of functions, and should not be deprecated / removed from the Swoole's API, in future, as it may be utilised effectively in developing different Design Patterns / Libraries / Frameworks around Swoole, like i showed "Toggling / Switching" between Co-routines, forever (or for specific number of iterations)".
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
With Reference to this Closed issue Cannot Resume a Coroutine which is in I/O mode Or non-existent
See my Comment as a Solution
It will be good if we have a more performant built-in function for that; A function which returns the (boolean) fact "whether the coroutine is in "yieldable" mode or not" (which replaces the less-performing condition below):
if (
Swoole\Coroutine::getBackTrace($cid1)[0]['function'] == 'yield'
) {...
}
Or may be you can update co::resume() such that it resumes the yielded coroutine only when it is yieldable (in "yieldable" moden: when it is released from I/O and / or co::sleep() )
Thanks in advance.
Also, with due regards, i would like to present my disagreement with this response
I think
co::yield()
/co::resume()
is a useful set of functions, and should not be deprecated / removed from the Swoole's API, in future, as it may be utilised effectively in developing different Design Patterns / Libraries / Frameworks around Swoole, like i showed "Toggling / Switching" between Co-routines, forever (or for specific number of iterations)".Beta Was this translation helpful? Give feedback.
All reactions