LibVNCServer: properly use thread-local storage

The TLS macro never has been defined due to the missing
LIBVNCSERVER_HAVE_TLS macro. This revises the macro logic to also cover
Win32 builds with MSVC.
pull/3/head
Tobias Junghans 6 years ago
parent cfdbb94038
commit 2411769962

@ -57,10 +57,11 @@
* that we resort to using thread local storage instead of having * that we resort to using thread local storage instead of having
* per-client data. * per-client data.
*/ */
#if LIBVNCSERVER_HAVE_LIBPTHREAD && LIBVNCSERVER_HAVE_TLS && !defined(TLS) && defined(__linux__) #if defined(__GNUC__)
#define TLS __thread #define TLS __thread
#endif #elif defined(_MSC_VER)
#ifndef TLS #define TLS __declspec(thread)
#else
#define TLS #define TLS
#endif #endif

@ -45,10 +45,11 @@
* tight. N.B. ZRLE does it the traditional way with per-client storage * tight. N.B. ZRLE does it the traditional way with per-client storage
* (and so at least ZRLE will work threaded on older systems.) * (and so at least ZRLE will work threaded on older systems.)
*/ */
#if LIBVNCSERVER_HAVE_LIBPTHREAD && LIBVNCSERVER_HAVE_TLS && !defined(TLS) && defined(__linux__) #if defined(__GNUC__)
#define TLS __thread #define TLS __thread
#endif #elif defined(_MSC_VER)
#ifndef TLS #define TLS __declspec(thread)
#else
#define TLS #define TLS
#endif #endif

Loading…
Cancel
Save