Refactor end of bootstrap using new work queue helper

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2018-10-09 07:14:33 +02:00
1 parent 4870cab898
commit df22628183
3 files changed
+65 -53

No files matched your search

+4 -29
View File
@@ -1243,21 +1243,20 @@ void service_runtask_clean(void)
}
/**
* service_runtask_completed - Have run/task completed in current runlevel
* @skip: Hardcoded list of conditions to skip
* service_completed - Have run/task completed in current runlevel
*
* This function checks if all run/task have run once in the current
* runlevel. E.g., at bootstrap we must wait for these scripts or
* programs to complete their run before switching to the configured
* runlevel.
*
* Setting @skip means skipping tasks with %HOOK_SVC_UP, %HOOK_SYSTEM_UP
* set in their condition mask. These tasks cannot run until finalize()
* All tasks with %HOOK_SVC_UP, %HOOK_SYSTEM_UP set in their condition
* mask are skipped. These tasks cannot run until finalize()
*
* Returns:
* %TRUE(1) or %FALSE(0)
*/
int service_runtask_completed(int skip)
int service_completed(void)
{
svc_t *svc, *iter = NULL;
@@ -1284,30 +1283,6 @@ int service_runtask_completed(int skip)
return 1;
}
/*
* Wait for system bootstrap to complete, should not take more than 120 sec.
*/
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;
if (cnt > 0)
_d("All run/task have completed, resuming bootstrap.");
else
_d("Timeout, resuming bootstrap.");
cnt = 10;
uev_timer_stop(w);
finalize();
}
/**
* Local Variables:
* indent-tabs-mode: t