mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
job: Add job_drain()
block_job_drain() contains a blk_drain() call which cannot be moved to Job, so add a new JobDriver callback JobDriver.drain which has a common implementation for all BlockJobs. In addition to this we keep the existing BlockJobDriver.drain callback that is called by the common drain implementation for all block jobs. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
@ -167,6 +167,13 @@ struct JobDriver {
|
||||
*/
|
||||
void (*user_resume)(Job *job);
|
||||
|
||||
/*
|
||||
* If the callback is not NULL, it will be invoked when the job has to be
|
||||
* synchronously cancelled or completed; it should drain any activities
|
||||
* as required to ensure progress.
|
||||
*/
|
||||
void (*drain)(Job *job);
|
||||
|
||||
/**
|
||||
* If the callback is not NULL, it will be invoked when all the jobs
|
||||
* belonging to the same transaction complete; or upon this job's
|
||||
@ -325,6 +332,12 @@ bool job_user_paused(Job *job);
|
||||
*/
|
||||
void job_user_resume(Job *job, Error **errp);
|
||||
|
||||
/*
|
||||
* Drain any activities as required to ensure progress. This can be called in a
|
||||
* loop to synchronously complete a job.
|
||||
*/
|
||||
void job_drain(Job *job);
|
||||
|
||||
/**
|
||||
* Get the next element from the list of block jobs after @job, or the
|
||||
* first one if @job is %NULL.
|
||||
|
||||
Reference in New Issue
Block a user