summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-04-19 13:59:16 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-04-26 16:15:34 +0200
commit6839b7714b80cf28614dcd793edcdeb70dc6ed5f (patch)
tree64e09634bcb1bd44febd414223c38d9ff3cf9146 /vcl/unx
parentea33797be1b683ca5743a00bd3347d0806bd62a8 (diff)
tdf#95843: Wait for fire_glxtest_process also in --headless mode
Discussed with mmeeks on IRC that fire_glxtest_process is probably called as early as possible so that its reuslt is ready by the time it is needed in the non-headless case. So best fix for headless is probably to just wait for the sub-process at an opportune point, instead of redesigning the whole mess so that fire_glxtest_process would only be called once its result is actually needed. Change-Id: I4ea9c9d54b83c9695a3b72317e68fed0c410da0e Reviewed-on: https://gerrit.libreoffice.org/53154 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 4bacf58f4af44ac8c4632b43289ccfcc07e5820c) Reviewed-on: https://gerrit.libreoffice.org/53170 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/glxtest.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/vcl/unx/glxtest.cxx b/vcl/unx/glxtest.cxx
index b0cdde234c2b..70d34fb7318d 100644
--- a/vcl/unx/glxtest.cxx
+++ b/vcl/unx/glxtest.cxx
@@ -27,6 +27,8 @@
#include <string.h>
#include <signal.h>
+#include <sys/wait.h>
+
#include <opengl/x11/glxtest.hxx>
#ifdef __SUNPRO_CC
@@ -36,6 +38,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <sal/log.hxx>
+
// stuff from glx.h
typedef struct __GLXcontextRec *GLXContext;
typedef XID GLXPixmap;
@@ -275,3 +279,15 @@ bool fire_glxtest_process()
*glxtest_pid = pid;
return true;
}
+
+void reap_glxtest_process() {
+ pid_t * pid = getGlxPid();
+ if (*pid != 0) {
+ // Use WNOHANG, as it is probably better to have a (rather harmless) zombie child process
+ // hanging around for the duration of the calling process, than to potentially block the
+ // calling process here:
+ pid_t e = waitpid(*pid, nullptr, WNOHANG);
+ SAL_INFO_IF(
+ e <= 0, "vcl.opengl", "waiting for glxtest process " << *pid << " failed with " << e);
+ }
+}