API refactor, allow svc_stop_completed() to return the pending svc

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-11 22:04:17 +02:00
parent 586f0a7799
commit 8a1015cf3e
2 changed files with 7 additions and 8 deletions
+6 -7
View File
@@ -307,20 +307,19 @@ void svc_foreach_type(int types, void (*cb)(svc_t *))
* svc_stop_completed - Have all stopped services been collected?
*
* Returns:
* 1, if all stopped services have been collected. 0 otherwise.
* %NULL if all stopped services have been collected, otherwise a
* pointer to the first svc_t waiting to be collected.
*/
int svc_stop_completed(void)
svc_t *svc_stop_completed(void)
{
svc_t *svc;
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
if (svc->state == SVC_STOPPING_STATE) {
_e("Waiting to collect %s(%d) ...", svc->cmd, svc->pid);
return 0;
}
if (svc->state == SVC_STOPPING_STATE)
return svc;
}
return 1;
return NULL;
}
/**
+1 -1
View File
@@ -158,7 +158,7 @@ void svc_foreach (void (*cb)(svc_t *));
void svc_foreach_dynamic (void (*cb)(svc_t *));
void svc_foreach_type (int types, void (*cb)(svc_t *));
int svc_stop_completed (void);
svc_t *svc_stop_completed (void);
void svc_mark_dynamic (void);
void svc_check_dirty (svc_t *svc, struct timeval *mtime);