diff options
Diffstat (limited to 'libcr')
-rw-r--r-- | libcr/coroutine.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c index 79ba894..25e3e4f 100644 --- a/libcr/coroutine.c +++ b/libcr/coroutine.c @@ -421,7 +421,7 @@ static inline void _cr_transition(enum coroutine_state state) { next = next_coroutine(); if (next) break; - if (state == CR_RUNNABLE) { + if (coroutine_table[coroutine_running-1].state == CR_RUNNABLE) { debugf("cid=%zu: no other runnable coroutines, not yielding\n", coroutine_running); coroutine_table[coroutine_running-1].state = CR_RUNNING; return; @@ -473,10 +473,13 @@ void cr_unpause_from_sighandler(cid_t cid) { switch (coroutine_table[cid-1].state) { case CR_RUNNING: + debugf("... raced, deferring unpause\n"); coroutine_table[cid-1].sig_unpause = true; break; case CR_PAUSED: - coroutine_table[cid-1].state = CR_RUNNABLE; + debugf("... actual unpause\n"); + coroutine_table[cid-1].sig_unpause = false; + coroutine_table[cid-1].state = CR_RUNNABLE; break; default: assertf(false, "cid=%zu state=%s\n", |