mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
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>
This commit is contained in:
@ -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;
|
||||
@ -167,6 +167,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.
|
||||
*
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user