X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fcurl_threads.c;h=c1624a913668e21a24e473755fea365be3e7e175;hb=cfd75dcdb18d0a4291f48020211c65507a97d9eb;hp=a78eff5c2f3ec948a56bad713a99479c19542307;hpb=24b9957402f17c422eeeb3386bf049feeb342e78;p=platform%2Fupstream%2Fcurl.git diff --git a/lib/curl_threads.c b/lib/curl_threads.c index a78eff5..c1624a9 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -104,15 +104,22 @@ int Curl_thread_join(curl_thread_t *hnd) curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *), void *arg) { + curl_thread_t t; #ifdef _WIN32_WCE - return CreateThread(NULL, 0, func, arg, 0, NULL); + t = CreateThread(NULL, 0, func, arg, 0, NULL); #else - curl_thread_t t; t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL); - if((t == 0) || (t == (curl_thread_t)-1L)) +#endif + if((t == 0) || (t == LongToHandle(-1L))) { +#ifdef _WIN32_WCE + DWORD gle = GetLastError(); + errno = ((gle == ERROR_ACCESS_DENIED || + gle == ERROR_NOT_ENOUGH_MEMORY) ? + EACCES : EINVAL); +#endif return curl_thread_t_null; + } return t; -#endif } void Curl_thread_destroy(curl_thread_t hnd)