mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
curl_threads: fix classic MinGW compile break
Classic MinGW still has _beginthreadex's return type as unsigned long instead of uintptr_t [0]. uintptr_t is not even defined because of [1]. [0] https://sourceforge.net/p/mingw/mingw-org-wsl/ci/wsl-5.1-release/tree/mingwrt/include/process.h#l167 [1] https://sourceforge.net/p/mingw/mingw-org-wsl/ci/wsl-5.1-release/tree/mingwrt/include/process.h#l90 Bug: https://github.com/curl/curl/issues/2924#issuecomment-424334807 Closes https://github.com/curl/curl/pull/3051
This commit is contained in:
parent
5616c1df28
commit
7ae78feea3
@ -104,13 +104,21 @@ int Curl_thread_join(curl_thread_t *hnd)
|
|||||||
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
curl_thread_t t;
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
t = CreateThread(NULL, 0, func, arg, 0, NULL);
|
typedef HANDLE curl_win_thread_handle_t;
|
||||||
|
#elif defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||||
|
typedef unsigned long curl_win_thread_handle_t;
|
||||||
#else
|
#else
|
||||||
uintptr_t thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
|
typedef uintptr_t curl_win_thread_handle_t;
|
||||||
t = (curl_thread_t)thread_handle;
|
|
||||||
#endif
|
#endif
|
||||||
|
curl_thread_t t;
|
||||||
|
curl_win_thread_handle_t thread_handle;
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
thread_handle = CreateThread(NULL, 0, func, arg, 0, NULL);
|
||||||
|
#else
|
||||||
|
thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
|
||||||
|
#endif
|
||||||
|
t = (curl_thread_t)thread_handle;
|
||||||
if((t == 0) || (t == LongToHandle(-1L))) {
|
if((t == 0) || (t == LongToHandle(-1L))) {
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
DWORD gle = GetLastError();
|
DWORD gle = GetLastError();
|
||||||
|
Loading…
Reference in New Issue
Block a user