From 6ebd71d186a6437d3472bea991f4298263d3644f Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 29 Jan 2010 17:47:54 +0000 Subject: [PATCH] WIN32 fix, _beginthreadex() may return either 0 or -1L upon failure --- lib/curl_threads.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 7c87c19a4..96304e440 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -101,7 +101,11 @@ curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), void #ifdef _WIN32_WCE return CreateThread(NULL, 0, func, arg, 0, NULL); #else - return (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL); + curl_thread_t t; + t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL); + if((t == 0) || (t == (curl_thread_t)-1L)) + return curl_thread_t_null; + return t; #endif }