Am 17/08/2022 um 10:04 schrieb Emanuele Giuseppe Esposito:
>>> +    /* protect against read in job_do_yield_locked */
>>> +    JOB_LOCK_GUARD();
>>> +    /* ensure the coroutine is quiescent while the AioContext is changed */
>>> +    assert(job->pause_count > 0);
>> job->pause_count only shows that pausing was requested. The coroutine is
>> only really quiescent if job->busy == false, too.
>>
>> Or maybe job->paused is actually the one you want here.
> I think job->paused works too.
> 

Actually it doesn't. At least test-block-iothread
test_propagate_mirror() fails, for both job->paused and !job->busy. I
think the reason is that if we wait for the flag to be set, we need to
actually wait that the job gets to the next pause point, because
job_pause() doesn't really pause the job, it just kind of "schedules"
the pause on next pause point.

So, either we leave pause_count > 0, or somehow wait (I was thinking
AIO_WAIT_WHILE(job->paused) but that's probably a very bad idea).

Do you have any suggestion for that?
Maybe Paolo has a better idea on how to do it?

Emanuele


Reply via email to