mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2025-12-20 04:40:10 +01:00
Add XFreeThreads function.
This commit is contained in:
parent
b4f24b272c
commit
696d19d5db
4 changed files with 40 additions and 1 deletions
|
|
@ -1735,6 +1735,10 @@ extern Status XInitThreads(
|
|||
void
|
||||
);
|
||||
|
||||
extern Status XFreeThreads(
|
||||
void
|
||||
);
|
||||
|
||||
extern void XLockDisplay(
|
||||
Display* /* display */
|
||||
);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ XInitThreads, XLockDisplay, XUnlockDisplay \- multi-threading support
|
|||
.HP
|
||||
Status XInitThreads\^(void);
|
||||
.HP
|
||||
Status XFreeThreads\^(void);
|
||||
.HP
|
||||
void XLockDisplay\^(\^Display *\fIdisplay\fP\^);
|
||||
.HP
|
||||
void XUnlockDisplay\^(\^Display *\fIdisplay\fP\^);
|
||||
|
|
@ -76,7 +78,11 @@ 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 programs not call this function.
|
||||
|
||||
.LP
|
||||
The
|
||||
.B XFreeThreads
|
||||
function frees the memory allocated by
|
||||
.BR XInitThreads .
|
||||
.LP
|
||||
The
|
||||
.B XLockDisplay
|
||||
|
|
|
|||
|
|
@ -105,4 +105,10 @@ xlib_ctor(void)
|
|||
{
|
||||
XInitThreads();
|
||||
}
|
||||
|
||||
__attribute__((destructor)) static void
|
||||
xlib_dtor(void)
|
||||
{
|
||||
XFreeThreads();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -673,9 +673,32 @@ Status XInitThreads(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
Status XFreeThreads(void)
|
||||
{
|
||||
if (global_lock.lock != NULL) {
|
||||
xmutex_free(global_lock.lock);
|
||||
global_lock.lock = NULL;
|
||||
}
|
||||
if (i18n_lock.lock != NULL) {
|
||||
xmutex_free(i18n_lock.lock);
|
||||
i18n_lock.lock = NULL;
|
||||
}
|
||||
if (conv_lock.lock != NULL) {
|
||||
xmutex_free(conv_lock.lock);
|
||||
conv_lock.lock = NULL;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* XTHREADS */
|
||||
Status XInitThreads(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Status XFreeThreads(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* XTHREADS */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue