mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Wait for all services to complete before changing runlevel
We allow all run/task/services to complete before changing runlevel. This means stepping them all while we wait for their completion, since services may depend on each other. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -481,6 +481,9 @@ int main(int argc, char* argv[])
|
||||
api_init(&loop);
|
||||
umask(022);
|
||||
|
||||
/* Finalize bootstrap, allow service/run/tasks to complete */
|
||||
service_step_all(SVC_TYPE_ANY);
|
||||
|
||||
/*
|
||||
* Wait for all SVC_TYPE_RUNTASK to have completed their work in
|
||||
* [S], or timeout, before calling finalize()
|
||||
|
||||
@@ -1267,6 +1267,9 @@ void service_bootstrap_cb(uev_t *w, void *arg, int events)
|
||||
static int cnt = 120;
|
||||
void (*finalize)(void) = arg;
|
||||
|
||||
_d("Step all services ...");
|
||||
service_step_all(SVC_TYPE_ANY);
|
||||
|
||||
_d("Checking completion of all run/task ... %d", cnt);
|
||||
if (cnt-- > 0 && !service_runtask_completed(!runlevel))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user