1XInitThreads(3)                 XLIB FUNCTIONS                 XInitThreads(3)
2
3
4

NAME

6       XInitThreads, XLockDisplay, XUnlockDisplay - multi-threading support
7

SYNTAX

9       Status XInitThreads(void);
10
11       Status XFreeThreads(void);
12
13       void XLockDisplay(Display *display);
14
15       void XUnlockDisplay(Display *display);
16

ARGUMENTS

18       display   Specifies the connection to the X server.
19

DESCRIPTION

21       The  XInitThreads  function  initializes  Xlib  support  for concurrent
22       threads.  This function must  be  the  first  Xlib  function  a  multi-
23       threaded program calls, and it must complete before any other Xlib call
24       is made.  This function returns a nonzero status if initialization  was
25       successful; otherwise, it returns zero.  On systems that do not support
26       threads, this function always returns zero.
27
28       It is only necessary to call this function if  multiple  threads  might
29       use Xlib concurrently.  If all calls to Xlib functions are protected by
30       some other access mechanism (for example, a mutual exclusion lock in  a
31       toolkit  or  through explicit client programming), Xlib thread initial‐
32       ization is not required.  It is recommended that  single-threaded  pro‐
33       grams not call this function.
34
35       The XFreeThreads function frees the memory allocated by XInitThreads.
36
37       The  XLockDisplay  function  locks out all other threads from using the
38       specified display.  Other threads attempting to use  the  display  will
39       block  until  the  display is unlocked by this thread.  Nested calls to
40       XLockDisplay work correctly; the display will not actually be  unlocked
41       until XUnlockDisplay has been called the same number of times as XLock‐
42       Display.  This function has no effect unless Xlib was successfully ini‐
43       tialized for threads using XInitThreads.
44
45       The  XUnlockDisplay  function allows other threads to use the specified
46       display again.  Any threads that have blocked on the  display  are  al‐
47       lowed to continue.  Nested locking works correctly; if XLockDisplay has
48       been called multiple times by a thread,  then  XUnlockDisplay  must  be
49       called  an  equal  number  of  times before the display is actually un‐
50       locked.  This function has no effect unless Xlib was successfully  ini‐
51       tialized for threads using XInitThreads.
52

SEE ALSO

54       Xlib - C Language X Interface
55
56
57
58X Version 11                     libX11 1.8.7                  XInitThreads(3)
Impressum