aboutsummaryrefslogtreecommitdiff
path: root/vis-subprocess.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis-subprocess.c')
-rw-r--r--vis-subprocess.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/vis-subprocess.c b/vis-subprocess.c
index 31a1479..e17d24f 100644
--- a/vis-subprocess.c
+++ b/vis-subprocess.c
@@ -230,3 +230,19 @@ void vis_process_tick(Vis *vis, fd_set *readfds) {
}
}
}
+
+/**
+ * Checks if each subprocess from the pool is dead or needs to be
+ * killed then raises an event or kills it if necessary.
+ */
+void vis_process_waitall(Vis *vis) {
+ for (Process **pointer = &process_pool; *pointer; ) {
+ Process *current = *pointer;
+ if (!wait_or_kill_process(vis, current)) {
+ pointer = &current->next;
+ } else {
+ /* update our iteration pointer */
+ *pointer = destroy_process(current);
+ }
+ }
+}