diff options
author | Jeff McGee <jeff.mcgee@intel.com> | 2014-01-28 18:25:04 -0600 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-02-06 07:45:53 +0100 |
commit | fd3fcbd3b3f12f878737d331d361de7eda0f579a (patch) | |
tree | 0b216a511ebab4128dcaf669cb198b14b787a527 /lib/drmtest.c | |
parent | 3bada1626cd35800533361296f4340f64b91321c (diff) |
lib/drmtest: Add igt_wait_helper
igt_wait_helper compliments igt_stop_helper and is used when helper
processes are expected to exit naturally.
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r-- | lib/drmtest.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 02496c5d..f4a86005 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -1246,6 +1246,23 @@ void igt_stop_helper(struct igt_helper_process *proc) helper_process_count--; } +void igt_wait_helper(struct igt_helper_process *proc) +{ + int status; + + assert(proc->running); + + while (waitpid(proc->pid, &status, 0) == -1 && + errno == EINTR) + ; + igt_assert(WIFEXITED(status) && WEXITSTATUS(status) == 0); + + proc->running = false; + + helper_process_pids[proc->id] = -1; + helper_process_count--; +} + static void children_exit_handler(int sig) { int ret; |