summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c26
-rw-r--r--lib/igt_core.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 403b9423..9c3b37fe 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1558,6 +1558,32 @@ bool __igt_fork(void)
}
/**
+ * igt_child_done:
+ *
+ * Lets the IGT core know that one of the children has exited.
+ */
+void igt_child_done(pid_t pid)
+{
+ int i = 0;
+ int found = -1;
+
+ igt_assert(num_test_children > 1);
+
+ for (i = 0; i < num_test_children; i++) {
+ if (pid == test_children[i]) {
+ found = i;
+ break;
+ }
+ }
+
+ igt_assert(found >= 0);
+
+ num_test_children--;
+ for (i = found; i < num_test_children; i++)
+ test_children[i] = test_children[i + 1];
+}
+
+/**
* igt_waitchildren:
*
* Wait for all children forked with igt_fork.
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 51b98d82..4a125af1 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -688,6 +688,7 @@ bool __igt_fork(void);
#define igt_fork(child, num_children) \
for (int child = 0; child < (num_children); child++) \
for (; __igt_fork(); exit(0))
+void igt_child_done(pid_t pid);
void igt_waitchildren(void);
void igt_waitchildren_timeout(int seconds, const char *reason);