On 10/02/2015 12:09, Kevin Wolf wrote:
>> >
>> > 4 mutex->locked = false;
>> > qemu_co_queue_next(&mutex->queue);
>> > '--> qemu_co_queue_do_restart(queue, true);
>> > '--> QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
>> > QTAILQ_INSERT_TAIL(&self->co_queue_wakeup, next,
>> > co_queue_next);
>> >
>> > 5 coroutine_swap(co1, leader, COROUTINE_YIELD);
>> >
>> > And co2 is never reentered until co1 terminates. Right?
> No, co2 will be reentered during the yield in line 5. However, it's not
> the yielding coroutine that reenters it but the parent, which is resumed
> at exactly the line of code that you quoted above.
So:
5 coroutine_swap(co1, leader, COROUTINE_YIELD);
'--> jumps back to qemu_coroutine_switch
'--> returns to qemu_coroutine_enter
qemu_co_queue_run_restart(co);
'--> QTAILQ_REMOVE(&co->co_queue_wakeup, next, co_queue_next);
qemu_coroutine_enter(next, NULL);
Thanks for the explanation. Series:
Reviewed-by: Paolo Bonzini <[email protected]>