aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-01-29 17:47:54 +0000
committerYang Tse <yangsita@gmail.com>2010-01-29 17:47:54 +0000
commit6ebd71d186a6437d3472bea991f4298263d3644f (patch)
treed053e2b8e683534bf2a457248a910538e8a130b0
parent4ee4e66c4f0b8bb765f30fffb175ae6cbbca8677 (diff)
WIN32 fix, _beginthreadex() may return either 0 or -1L upon failure
-rw-r--r--lib/curl_threads.c6
1 files changed, 5 insertions, 1 deletions
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
}