aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'job.c')
-rw-r--r--job.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/job.c b/job.c
index dd46170418..817c3b4426 100644
--- a/job.c
+++ b/job.c
@@ -215,6 +215,10 @@ void *job_create(const char *job_id, const JobDriver *driver, AioContext *ctx,
job->auto_finalize = !(flags & JOB_MANUAL_FINALIZE);
job->auto_dismiss = !(flags & JOB_MANUAL_DISMISS);
+ notifier_list_init(&job->on_finalize_cancelled);
+ notifier_list_init(&job->on_finalize_completed);
+ notifier_list_init(&job->on_pending);
+
job_state_transition(job, JOB_STATUS_CREATED);
aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
QEMU_CLOCK_REALTIME, SCALE_NS,
@@ -247,6 +251,21 @@ void job_unref(Job *job)
}
}
+void job_event_cancelled(Job *job)
+{
+ notifier_list_notify(&job->on_finalize_cancelled, job);
+}
+
+void job_event_completed(Job *job)
+{
+ notifier_list_notify(&job->on_finalize_completed, job);
+}
+
+void job_event_pending(Job *job)
+{
+ notifier_list_notify(&job->on_pending, job);
+}
+
void job_enter_cond(Job *job, bool(*fn)(Job *job))
{
if (!job_started(job)) {