Commit afcdb6fb authored by Adam Jackson's avatar Adam Jackson 🎧
Browse files

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

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 assumes your compiler understands __attribute__((constructor)). If
this is not your compiler, you can disable this with the appropriate
configure flag, but be aware you're asking for bugs.

Signed-off-by: Adam Jackson's avatarAdam Jackson <>
parent 1ab48f3c
Pipeline #572272 passed with stages
in 5 minutes and 26 seconds
......@@ -148,6 +148,15 @@ if test x$XLIB_LOADABLE_XCURSOR = xyes; then
[Controls mandatory thread safety support],
if test "x$USE_THREAD_SAFETY_CONSTRUCTOR" = "xyes"; then
AC_DEFINE(USE_THREAD_SAFETY_CONSTRUCTOR,1,[Call XInitThreads() from the library constructor])
# Checks for header files.
AC_CHECK_HEADERS([sys/filio.h sys/select.h sys/ioctl.h sys/socket.h])
......@@ -97,12 +97,10 @@ int XTestInputActionType = 0;
int XTestFakeAckType = 1;
* NOTE: any additional external definition NEED
* to be inserted BELOW this point!!!
* NOTE: any additional external definition NEED
* to be inserted ABOVE this point!!!
__attribute__((constructor)) static void
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment