diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2022-01-19 00:45:43 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-04-27 14:08:46 +0200 |
commit | 4875a15ca61358a1c95b156b2279fce092451278 (patch) | |
tree | 79054df1730d4723658b02cec311bc8ba7655662 /nx-X11/lib/src/locking.c | |
parent | a502149a844736dcc7f7dedd7c63229c74a448ee (diff) | |
download | nx-libs-4875a15ca61358a1c95b156b2279fce092451278.tar.gz nx-libs-4875a15ca61358a1c95b156b2279fce092451278.tar.bz2 nx-libs-4875a15ca61358a1c95b156b2279fce092451278.zip |
Update libNX_X11 to upstream's libX11-1.7.3.1-10-gd60ede78
Diffstat (limited to 'nx-X11/lib/src/locking.c')
-rw-r--r-- | nx-X11/lib/src/locking.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nx-X11/lib/src/locking.c b/nx-X11/lib/src/locking.c index 9f4fe0677..ea5000e15 100644 --- a/nx-X11/lib/src/locking.c +++ b/nx-X11/lib/src/locking.c @@ -66,6 +66,8 @@ in this Software without prior written authorization from The Open Group. /* in lcWrap.c */ extern LockInfoPtr _Xi18n_lock; +/* in lcConv.c */ +extern LockInfoPtr _conv_lock; #ifdef WIN32 static DWORD _X_TlsIndex = (DWORD)-1; @@ -98,6 +100,7 @@ static xthread_t _Xthread_self(void) static LockInfoRec global_lock; static LockInfoRec i18n_lock; +static LockInfoRec conv_lock; static void _XLockMutex( LockInfoPtr lip @@ -130,6 +133,7 @@ static void _XFreeMutex( { xmutex_clear(lip->lock); xmutex_free(lip->lock); + lip->lock = NULL; } #ifdef XTHREADS_WARN @@ -453,6 +457,9 @@ static void _XLockDisplay( XTHREADS_FILE_LINE_ARGS ) { +#ifdef XTHREADS + struct _XErrorThreadInfo *ti; +#endif #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); #else @@ -460,6 +467,15 @@ static void _XLockDisplay( #endif if (dpy->lock->locking_level > 0) _XDisplayLockWait(dpy); +#ifdef XTHREADS + /* + * Skip the two function calls below which may generate requests + * when LockDisplay is called from within _XError. + */ + for (ti = dpy->error_threads; ti; ti = ti->next) + if (ti->error_thread == xthread_self()) + return; +#endif _XIDHandler(dpy); _XSeqSyncFunction(dpy); } @@ -594,12 +610,22 @@ Status XInitThreads(void) global_lock.lock = NULL; return 0; } + if (!(conv_lock.lock = xmutex_malloc())) { + xmutex_free(global_lock.lock); + global_lock.lock = NULL; + xmutex_free(i18n_lock.lock); + i18n_lock.lock = NULL; + return 0; + } _Xglobal_lock = &global_lock; xmutex_init(_Xglobal_lock->lock); xmutex_set_name(_Xglobal_lock->lock, "Xlib global"); _Xi18n_lock = &i18n_lock; xmutex_init(_Xi18n_lock->lock); xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n"); + _conv_lock = &conv_lock; + xmutex_init(_conv_lock->lock); + xmutex_set_name(_conv_lock->lock, "Xlib conv"); _XLockMutex_fn = _XLockMutex; _XUnlockMutex_fn = _XUnlockMutex; _XCreateMutex_fn = _XCreateMutex; |