XInitThreads(3X11) XLIB FUNCTIONS XInitThreads(3X11)
XInitThreads, XLockDisplay, XUnlockDisplay - multi-threading
support
Status XInitThreads(void);
void XLockDisplay(Display *display);
void XUnlockDisplay(Display *display);
display Specifies the connection to the X server.
The XInitThreads function initializes Xlib support for con-
current threads. This function must be the first Xlib func-
tion a multi-threaded program calls, and it must complete
before any other Xlib call is made. This function returns a
nonzero status if initialization was successful; otherwise,
it returns zero. On systems that do not support threads,
this function always returns zero.
It is only necessary to call this function if multiple
threads might use Xlib concurrently. If all calls to Xlib
functions are protected by some other access mechanism (for
example, a mutual exclusion lock in a toolkit or through
explicit client programming), Xlib thread initialization is
not required. It is recommended that single-threaded pro-
grams not call this function.
The XLockDisplay function locks out all other threads from
using the specified display. Other threads attempting to use
the display will block until the display is unlocked by this
thread. Nested calls to XLockDisplay work correctly; the
display will not actually be unlocked until XUnlockDisplay
has been called the same number of times as XLockDisplay.
This function has no effect unless Xlib was successfully
initialized for threads using XInitThreads.
The XUnlockDisplay function allows other threads to use the
specified display again. Any threads that have blocked on
the display are allowed to continue. Nested locking works
correctly; if XLockDisplay has been called multiple times by
a thread, then XUnlockDisplay must be called an equal number
of times before the display is actually unlocked. This func-
tion has no effect unless Xlib was successfully initialized
for threads using XInitThreads.
Xlib - C Language X Interface
XFree86 Version 4.5.0 1
Generated on 2012-02-20 02:47:02 by $MirOS: src/scripts/roff2htm,v 1.70 2011/12/03 18:21:12 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2011 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.