Xlib, GLX: XNextEvent() and glXSwapBuffers() concurrency?

Chrysme chrysme at gmail.com
Thu Jan 21 18:59:13 PST 2010


Hi,


This question is Xlib-specific, but this seems like the best place to
ask: is it possible to have both XNextEvent() and glXSwapBuffers()
blocking simultaneously in separate threads?

glXSwapBuffers() can be set to block (via GLX extension, or at the
OpenGL driver's discretion), waiting for vsync. I want to process user
input and window events while this call is blocking, for that I would
need to call XNextEvent() (also blocking) and associated functions
from another thread.

I know Xlib is not thread-safe initially, and XInitThreads() enables
an internal Xlib mutex to remedy this problem. But how does this mutex
interact with blocking Xlib functions? Specifically, is the lock
released when they block, or do they get to execute sequentially? Is
there a guaranteed behavior on this, or is it implementation
dependent? I found no clear reference in the Xlib or GLX
documentation.


Thanks in advance



More information about the xorg mailing list