XInitThreads in library constructor breaks Motif!

Po Lu luangruo at yahoo.com
Sun Oct 30 02:00:40 UTC 2022


Motif assumes that you can call functions that lock the display inside
XCheckIfEvent as it never calls XInitThreads itself.  It also never uses
threads.

Please revert the following change to Xlib:

commit afcdb6fb0045c6186aa83d9298f327a7ec1b2cb9
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Mar 22 18:24:29 2022 -0400

    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 <ajax at redhat.com>

as it stops Motif from working (this is easily seen by dragging
something onto a Motif program and observing the ensuing hang.)


More information about the xorg-devel mailing list