mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +00:00
service.c: set/clear condition 'done' for run tasks
We like to know when a runtask (run/task/sysv)is done, so as to start the services that depending on it, set a oneshot condition 'done' for that case and clear it when runtask services enter HALTED state. Signed-off-by: Ming Liu <liu.ming50@gmail.com>
This commit is contained in:
1 parent
f930953e6a
commit
f0f358a138
1 file changed
+15
@@ -1677,6 +1677,21 @@ static void svc_set_state(svc_t *svc, svc_state_t new)
|
||||
service_timeout_cancel(svc);
|
||||
service_timeout_after(svc, svc->killdelay, service_kill);
|
||||
}
|
||||
|
||||
if (svc_is_runtask(svc)) {
|
||||
char cond[MAX_COND_LEN];
|
||||
|
||||
snprintf(cond, sizeof(cond), "%s/%s/done", svc->type, svc->name);
|
||||
|
||||
/* create done condition when entering SVC_DONE_STATE. */
|
||||
if (*state == SVC_DONE_STATE)
|
||||
cond_set_oneshot(cond);
|
||||
|
||||
/* clear done condition when entering SVC_HALTED_STATE. */
|
||||
if (*state == SVC_HALTED_STATE)
|
||||
cond_clear(cond);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user