diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2018-04-18 16:32:20 +0200 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:50 +0200 |
| commit | 5d43e86e11f488fda7956b13160e0c0105a84845 (patch) | |
| tree | b5c4200538b55bb476e92b197a352ea4e3c09ce0 /include/qemu | |
| parent | da01ff7f38f52791f93fc3ca59afcfbb220f15af (diff) | |
| download | focaccia-qemu-5d43e86e11f488fda7956b13160e0c0105a84845.tar.gz focaccia-qemu-5d43e86e11f488fda7956b13160e0c0105a84845.zip | |
job: Add job_sleep_ns()
There is nothing block layer specific about block_job_sleep_ns(), so move the function to Job. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/qemu')
| -rw-r--r-- | include/qemu/job.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/qemu/job.h b/include/qemu/job.h index 9dcff12283..509408f747 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -58,7 +58,7 @@ typedef struct Job { Coroutine *co; /** - * Timer that is used by @block_job_sleep_ns. Accessed under job_mutex (in + * Timer that is used by @job_sleep_ns. Accessed under job_mutex (in * job.c). */ QEMUTimer sleep_timer; @@ -168,6 +168,13 @@ void job_enter_cond(Job *job, bool(*fn)(Job *job)); void job_start(Job *job); /** + * @job: The job to enter. + * + * Continue the specified job by entering the coroutine. + */ +void job_enter(Job *job); + +/** * @job: The job that is ready to pause. * * Pause now if job_pause() has been called. Jobs that perform lots of I/O @@ -175,6 +182,16 @@ void job_start(Job *job); */ void coroutine_fn job_pause_point(Job *job); +/** + * @job: The job that calls the function. + * @ns: How many nanoseconds to stop for. + * + * Put the job to sleep (assuming that it wasn't canceled) for @ns + * %QEMU_CLOCK_REALTIME nanoseconds. Canceling the job will immediately + * interrupt the wait. + */ +void coroutine_fn job_sleep_ns(Job *job, int64_t ns); + /** Returns the JobType of a given Job. */ JobType job_type(const Job *job); |