diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
commit | 051d521f6e20761ba6831cecd91883da960fa931 (patch) | |
tree | b28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/locking.c | |
parent | 6dce607bad8711dd06a5a7b69ad1930386b4123b (diff) | |
parent | b8de7bf654929c823080b211aeac56cd213f5a32 (diff) | |
download | nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2 nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip |
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214
Fixes ArcticaProject/nx-libs#157.
Diffstat (limited to 'nx-X11/lib/X11/locking.c')
-rw-r--r-- | nx-X11/lib/X11/locking.c | 120 |
1 files changed, 46 insertions, 74 deletions
diff --git a/nx-X11/lib/X11/locking.c b/nx-X11/lib/X11/locking.c index a888be4f2..4f9a40fbd 100644 --- a/nx-X11/lib/X11/locking.c +++ b/nx-X11/lib/X11/locking.c @@ -1,5 +1,5 @@ /* - + Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -45,11 +45,23 @@ in this Software without prior written authorization from The Open Group. #include <dlfcn.h> #endif +#include "Xprivate.h" #include "locking.h" #ifdef XTHREADS_WARN #include <stdio.h> /* for warn/debug stuff */ #endif +/* Additional arguments for source code location lock call was made from */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +# define XTHREADS_FILE_LINE_ARGS \ + , \ + char* file, /* source file, from macro */ \ + int line +#else +# define XTHREADS_FILE_LINE_ARGS /* None */ +#endif + + #define NUM_FREE_CVLS 4 /* in lcWrap.c */ @@ -58,14 +70,14 @@ extern LockInfoPtr _Xi18n_lock; #ifdef WIN32 static DWORD _X_TlsIndex = (DWORD)-1; -_Xthread_init() +void _Xthread_init(void) { if (_X_TlsIndex == (DWORD)-1) _X_TlsIndex = TlsAlloc(); } struct _xthread_waiter * -_Xthread_waiter() +_Xthread_waiter(void) { struct _xthread_waiter *me; @@ -87,28 +99,18 @@ static xthread_t _Xthread_self(void) static LockInfoRec global_lock; static LockInfoRec i18n_lock; -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XLockMutex(lip,file,line) - LockInfoPtr lip; - char* file; - int line; -#else static void _XLockMutex( - LockInfoPtr lip) -#endif + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) { xmutex_lock(lip->lock); } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) static void _XUnlockMutex( - LockInfoPtr lip, - char* file, - int line) -#else -static void _XUnlockMutex( - LockInfoPtr lip) -#endif + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) { xmutex_unlock(lip->lock); } @@ -200,15 +202,10 @@ static void _XLockDisplayWarn( } #endif /* XTHREADS_WARN */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XUnlockDisplay(dpy,file,line) - Display *dpy; - char *file; - int line; -#else static void _XUnlockDisplay( - Display *dpy) -#endif + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); @@ -328,23 +325,17 @@ static void _XPopReader( } } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionWait(cv, mutex,file,line) - xcondition_t cv; - xmutex_t mutex; - char *file; - int line; -#else static void _XConditionWait( xcondition_t cv, - xmutex_t mutex) -#endif + xmutex_t mutex + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); char *old_file = locking_file; int old_line = locking_line; - + #ifdef XTHREADS_DEBUG printf("line %d thread %x in condition wait\n", line, self); #endif @@ -379,15 +370,10 @@ static void _XConditionWait( #endif /* XTHREADS_WARN */ } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionSignal(cv,file,line) - xcondition_t cv; - char *file; - int line; -#else static void _XConditionSignal( - xcondition_t cv) -#endif + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG @@ -396,17 +382,12 @@ static void _XConditionSignal( #endif xcondition_signal(cv); } - -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionBroadcast(cv,file,line) - xcondition_t cv; - char *file; - int line; -#else + static void _XConditionBroadcast( - xcondition_t cv) -#endif + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG @@ -415,7 +396,7 @@ static void _XConditionBroadcast( #endif xcondition_broadcast(cv); } - + static void _XFreeDisplayLock( Display *dpy) @@ -467,15 +448,10 @@ static void _XDisplayLockWait( } } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XLockDisplay(dpy, file, line) - Display *dpy; - char *file; /* source file, from macro */ - int line; -#else static void _XLockDisplay( - Display *dpy) -#endif + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); @@ -484,23 +460,19 @@ static void _XLockDisplay( #endif if (dpy->lock->locking_level > 0) _XDisplayLockWait(dpy); + _XIDHandler(dpy); + _XSeqSyncFunction(dpy); } /* * _XReply is allowed to exit from select/poll and clean up even if a * user-level lock is in force, so it uses this instead of _XFancyLockDisplay. */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XInternalLockDisplay(dpy, wskip, file, line) - Display *dpy; - Bool wskip; - char *file; /* source file, from macro */ - int line; -#else static void _XInternalLockDisplay( Display *dpy, - Bool wskip) -#endif + Bool wskip + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); @@ -595,7 +567,7 @@ xthread_t (*_x11_thr_self)() = __x11_thr_self; #endif -Status XInitThreads() +Status XInitThreads(void) { if (_Xglobal_lock) return 1; @@ -644,7 +616,7 @@ Status XInitThreads() } #else /* XTHREADS */ -Status XInitThreads() +Status XInitThreads(void) { return 0; } |