From 94d058b35f075cec2d6e8b6e37ee1a94086ea3f8 Mon Sep 17 00:00:00 2001 From: runge Date: Thu, 21 May 2009 10:57:03 -0400 Subject: Thread safety. Fix -clip -in -rawfb. Try to avoid Xorg stuck key bug. --- x11vnc/util.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'x11vnc/util.h') diff --git a/x11vnc/util.h b/x11vnc/util.h index 2749e41..2136fe1 100644 --- a/x11vnc/util.h +++ b/x11vnc/util.h @@ -118,4 +118,23 @@ extern MUTEX(scrollMutex); #define SCR_UNLOCK if (use_threads) {UNLOCK(scrollMutex);} #define SCR_INIT INIT_MUTEX(scrollMutex) +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD +MUTEX(clientMutex); +#endif +#define CLIENT_LOCK if (use_threads) {LOCK(clientMutex);} +#define CLIENT_UNLOCK if (use_threads) {UNLOCK(clientMutex);} +#define CLIENT_INIT INIT_MUTEX(clientMutex) + +/* + * The sendMutex member was added to libvncserver 0.9.8 + * rfb/rfb.h sets LIBVNCSERVER_SEND_MUTEX if present. + */ +#if LIBVNCSERVER_HAVE_LIBPTHREAD && defined(LIBVNCSERVER_SEND_MUTEX) +#define SEND_LOCK(cl) if (use_threads) LOCK((cl)->sendMutex); +#define SEND_UNLOCK(cl) if (use_threads) UNLOCK((cl)->sendMutex); +#else +#define SEND_LOCK(cl) +#define SEND_UNLOCK(cl) +#endif + #endif /* _X11VNC_UTIL_H */ -- cgit v1.2.1