The X libraries used to implement X clients (such as Wine)
do not work properly if multiple threads access the same
display concurrently. It is possible to compile the X
libraries to perform their own synchronization (initiated
Wine does not use this approach. Instead Wine performs its
own synchronization using the
functions. This locking protects library access
with a critical section, and also arranges things so that
X libraries compiled without
(eg. with global
errno variable) will
work with Wine.
In the past, all calls to X used to go through a wrapper called
TSX...() (for "Thread Safe X ...").
While it is still being used in the code, it's inefficient
as the lock is potentially acquired and released unnecessarily.
New code should explicitly acquire the lock.