diff options
author | Curl Upstream <curl-library@cool.haxx.se> | 2017-10-04 05:52:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-10 15:15:03 (GMT) |
commit | de7c21d677db1ddaeece03c19e13e448f4031511 (patch) | |
tree | f812bbd3771bd01de9f7cd91a557766605f6ed2c /lib/curl_threads.c | |
parent | 06d6d6c4aee149cd6560b919ef6935ef0867d921 (diff) | |
download | CMake-de7c21d677db1ddaeece03c19e13e448f4031511.zip CMake-de7c21d677db1ddaeece03c19e13e448f4031511.tar.gz CMake-de7c21d677db1ddaeece03c19e13e448f4031511.tar.bz2 |
curl 2017-10-04 (3ea76790)
Code extracted from:
https://github.com/curl/curl.git
at commit 3ea76790571c1f7cf1bed34fabffd3cc20ad3dd3 (curl-7_56_0).
Diffstat (limited to 'lib/curl_threads.c')
-rw-r--r-- | lib/curl_threads.c | 15 |
1 files changed, 11 insertions, 4 deletions
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) |