1XInitThreads(3) XLIB FUNCTIONS XInitThreads(3)
2
3
4
6 XInitThreads, XLockDisplay, XUnlockDisplay - multi-threading support
7
9 Status XInitThreads(void);
10
11 void XLockDisplay(Display *display);
12
13 void XUnlockDisplay(Display *display);
14
16 display Specifies the connection to the X server.
17
19 The XInitThreads function initializes Xlib support for concurrent
20 threads. This function must be the first Xlib function a multi-
21 threaded program calls, and it must complete before any other Xlib call
22 is made. This function returns a nonzero status if initialization was
23 successful; otherwise, it returns zero. On systems that do not support
24 threads, this function always returns zero.
25
26 It is only necessary to call this function if multiple threads might
27 use Xlib concurrently. If all calls to Xlib functions are protected by
28 some other access mechanism (for example, a mutual exclusion lock in a
29 toolkit or through explicit client programming), Xlib thread initial‐
30 ization is not required. It is recommended that single-threaded pro‐
31 grams not call this function.
32
33
34 The XLockDisplay function locks out all other threads from using the
35 specified display. Other threads attempting to use the display will
36 block until the display is unlocked by this thread. Nested calls to
37 XLockDisplay work correctly; the display will not actually be unlocked
38 until XUnlockDisplay has been called the same number of times as XLock‐
39 Display. This function has no effect unless Xlib was successfully ini‐
40 tialized for threads using XInitThreads.
41
42 The XUnlockDisplay function allows other threads to use the specified
43 display again. Any threads that have blocked on the display are
44 allowed to continue. Nested locking works correctly; if XLockDisplay
45 has been called multiple times by a thread, then XUnlockDisplay must be
46 called an equal number of times before the display is actually
47 unlocked. This function has no effect unless Xlib was successfully
48 initialized for threads using XInitThreads.
49
51 Xlib - C Language X Interface
52
53
54
55X Version 11 libX11 1.3.4 XInitThreads(3)