From 833ce707183ecea46a2c0db2f1b8dc1a3bc4d1d4 Mon Sep 17 00:00:00 2001 From: Liran Date: Thu, 28 Jul 2011 11:13:12 +0300 Subject: [PATCH] opengles emulator: Call XInitThreads on Linux. All the X calls we do on linux are made from the FrameBuffer object which is locked however OpenGL implementations may call to Xlib during gl function calls. In order to be thread safe we initialize Xlib to support multi-threading. Change-Id: I3bc6a6378d7558fec44052bd67388beaf270c107 --- tools/emulator/opengl/host/renderer/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/emulator/opengl/host/renderer/main.cpp b/tools/emulator/opengl/host/renderer/main.cpp index dba319022..332c9ebef 100644 --- a/tools/emulator/opengl/host/renderer/main.cpp +++ b/tools/emulator/opengl/host/renderer/main.cpp @@ -26,6 +26,9 @@ #include #endif +#ifdef __linux__ +#include +#endif static void printUsage(const char *progName) { @@ -105,6 +108,15 @@ int main(int argc, char *argv[]) printf( "could not initialize Winsock\n" ); } #endif + +#ifdef __linux__ + // some OpenGL implementations may call X functions + // it is safer to synchronize all X calls made by all the + // rendering threads. (although the calls we do are locked + // in the FrameBuffer singleton object). + XInitThreads(); +#endif + // // initialize Framebuffer //