libaco
libaco copied to clipboard
Add aco_yield_to()
This pull request introduces aco_yield_to()
that enables a non-main co to yield to another co with a single context switch.
The first patch, namely add aco_yield_to(), seems a little complicated because part of the code of aco_resume()
is moved to a new auxiliary function called aco_own_stack()
to avoid duplicating code at aco_yield_to()
. Ignoring this code movement, the additions are straightforward.
The second patch adds test_aco_tutorial_7.c
to test and show how to use aco_yield_to()
.
This pull request closes #31