Skip to content

Commit

Permalink
faster X11 server polling (b1236a9 + 6988d58)
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed May 14, 2021
1 parent a4d19bf commit ed5f289
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xpra/x11/bindings/wait_for_x_server.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ cdef extern from "X11/Xlib.h":
def wait_for_x_server(display_name, int timeout):
cdef Display * d
cdef char* name
if display_name is not None:
name = display_name
else:
name = NULL
t = 100
cdef double start = monotonic_time()
name = display_name
first_time = True
while first_time or (monotonic_time() - start) < timeout:
if not first_time:
sleep(0.2)
first_time = False
while (monotonic_time() - start) < timeout:
d = XOpenDisplay(name)
if d is not NULL:
XCloseDisplay(d)
return
if t>0:
sleep(t/1000)
t = t//2
raise RuntimeError("could not connect to X server on display '%s' after %i seconds" % (bytestostr(display_name), timeout))

0 comments on commit ed5f289

Please sign in to comment.