Skip to content

global: call XInitThreads() from the library's constructor

Adam Jackson requested to merge ajax/libx11:always-xinitthreads into master

There is really no point in not being thread safe, I measured, all you can see happen is noop performance gets like twice as slow and you have thread safety bugs. And we're using xcb as the transport which means we should expect threads in our clients anyway. Just do it.

This is a weaksauce fix because you could inline a lot of this away now, but this is about as much time as I can justify thinking about this.

Signed-off-by: Adam Jackson ajax@redhat.com


This is probably not mergeable in its current state since constructors aren't necessarily available in your compiler, but I wanted to at least throw this out there for discussion. Mesa's xcb code really wants to be able to use multiple threads, and if the xcb/xlib interface is going to be broken if the client didn't already call XInitThreads then there's really no point in using xcb over raw xlib.

Merge request reports