Wine HQ

  WineHQ Menu
 WineHQ
 AppDB
 Bugzilla
 Wine Wiki
 Wine Forums

  About
 Introduction
 Features
 Screenshots
 Contributing
 News
 Press
 License

  Download
 Get Wine Now

  Support
 Getting Help
 FAQ
 Documentation
 HowTo
 Live Support Chat
 Paid Support

  Development
 Developers Guide
 Mailing Lists
 GIT
 Sending Patches
 To Do Lists
 Fun Projects
 Janitorial
 Winelib
 Status
 Resources
 WineConf

Search WineHQ
Graphical modules

Chapter 9. Graphical modules

9.1. GDI Module

9.1.1. X Windows System interface

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 by calling XInitThreads()). However, Wine does not use this approach. Instead Wine performs its own synchronization using the wine_tsx11_lock() / wine_tsx11_unlock() functions. This locking protects library access with a critical section, and also arranges things so that X libraries compiled without -D_REENTRANT (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.