  <chapter>
    <title>Graphical modules</title>
    <sect1>
      <title>GDI Module</title>

      <sect2>
	<title>X Windows System interface</title>

	<para>
	  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 <function>XInitThreads()</function>). However,
	  Wine does not use this approach. Instead Wine performs its
	  own synchronization using the
	  <function>wine_tsx11_lock()</function> / <function>wine_tsx11_unlock()</function>
	  functions.  This locking protects library access
	  with a critical section, and also arranges things so that
	  X libraries compiled without <option>-D_REENTRANT</option>
	  (eg. with global <varname>errno</varname> variable) will
	  work with Wine.
	</para>
	<para>
	  In the past, all calls to X used to go through a wrapper called
	  <function>TSX...()</function> (for "Thread Safe X ...").
	  While it is still being used in the code, it's inefficient
	  as the lock is potentially aquired and released unnecessarily.
	  New code should explicitly aquire the lock.
	</para>
      </sect2>
    </sect1>
  </chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-parent-document:("wine-devel.sgml" "set" "book" "part" "chapter" "")
End:
-->
