But loop more often. On my machine the average wait time for the server to start up appears to be ~600 us. Play it safe, usleep for 100us only and then try again.
Signed-off-by: Peter Hutterer <[email protected]> --- src/xserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xserver.cpp b/src/xserver.cpp index d371421..28f2eca 100644 --- a/src/xserver.cpp +++ b/src/xserver.cpp @@ -222,7 +222,7 @@ bool xorg::testing::XServer::WaitForDevice(::Display *display, const std::string } void xorg::testing::XServer::WaitForConnections(void) { - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < 100; ++i) { Display *test_display = XOpenDisplay(GetDisplayString().c_str()); if (test_display) { @@ -243,7 +243,7 @@ void xorg::testing::XServer::WaitForConnections(void) { message += " for any errors"; throw std::runtime_error(message); } else if (pid == 0) { - sleep(1); /* Give the X server some time to start */ + usleep(100); } else if (pid == -1) { throw std::runtime_error("Could not get status of X server process"); } else { -- 1.7.11.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
