From a9b860765d84b975bf1165ccc0dac2ff3c1789ae Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 26 Jan 2010 08:43:21 +0000 Subject: [PATCH] onstantine Sapuntzakis threaded resolver enhancements --- lib/hostthre.c | 4 ---- lib/setup.h | 47 ++++++++++++++++++++++------------------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/lib/hostthre.c b/lib/hostthre.c index 2205c8fdd..9772351c1 100644 --- a/lib/hostthre.c +++ b/lib/hostthre.c @@ -84,10 +84,6 @@ /* The last #include file should be: */ #include "memdebug.h" -#if defined(_MSC_VER) && defined(CURL_NO__BEGINTHREADEX) -#pragma message ("No _beginthreadex() available in this RTL") -#endif - /*********************************************************************** * Only for threaded name resolves builds **********************************************************************/ diff --git a/lib/setup.h b/lib/setup.h index 980a91699..ced3face5 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -428,36 +428,37 @@ /* CURLRES_* defines to use in the host*.c sources */ /* ---------------------------------------------------------------- */ -#if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \ - !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */ -#ifdef ENABLE_IPV6 -#define USE_THREADING_GETADDRINFO -#else -#define USE_THREADING_GETHOSTBYNAME /* Cygwin uses alarm() function */ -#endif +/* + * lcc-win32 doesn't have _beginthreadex(), lacks threads support. + */ + +#if defined(__LCC__) && defined(WIN32) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 #endif -/* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where - _beginthreadex() is not available */ -#if (defined(_MSC_VER) && !defined(__POCC__)) && !defined(_MT) && !defined(USE_ARES) -#undef USE_THREADING_GETADDRINFO -#undef USE_THREADING_GETHOSTBYNAME -#define CURL_NO__BEGINTHREADEX +/* + * MSVC threads support requires a multi-threaded runtime library. + * _beginthreadex() is not available in single-threaded ones. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 #endif +/* + * Mutually exclusive CURLRES_* definitions. + */ + #ifdef USE_ARES # define CURLRES_ASYNCH # define CURLRES_ARES -#endif - -#ifdef USE_THREADING_GETHOSTBYNAME -# define CURLRES_ASYNCH -# define CURLRES_THREADED -#endif - -#ifdef USE_THREADING_GETADDRINFO +#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) # define CURLRES_ASYNCH # define CURLRES_THREADED +#else +# define CURLRES_SYNCH #endif #ifdef ENABLE_IPV6 @@ -466,10 +467,6 @@ # define CURLRES_IPV4 #endif -#ifndef CURLRES_ASYNCH -# define CURLRES_SYNCH -#endif - /* ---------------------------------------------------------------- */ /*