From 48e86bc03f2e770f6e8df687b8fedd1814586159 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 3 Sep 2025 23:14:13 +0200 Subject: [PATCH] try moving win32 to CreateThread() API 3 --- lib/curl_setup.h | 6 ------ lib/curl_threads.h | 2 ++ tests/libtest/lib3026.c | 2 +- tests/server/sockfilt.c | 2 +- tests/server/util.c | 4 ++-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 517769c3b4..e0fbce92e4 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -640,12 +640,6 @@ #endif #endif -#ifdef _WIN32 -#define CURL_THREAD_RETURN_T DWORD -#else -#define CURL_THREAD_RETURN_T unsigned int -#endif - /* * Arg 2 type for gethostname in case it has not been defined in config file. */ diff --git a/lib/curl_threads.h b/lib/curl_threads.h index fb8b2ad723..c8dffa3585 100644 --- a/lib/curl_threads.h +++ b/lib/curl_threads.h @@ -26,6 +26,7 @@ #include "curl_setup.h" #ifdef USE_THREADS_POSIX +# define CURL_THREAD_RETURN_T unsigned int # define CURL_STDCALL # define curl_mutex_t pthread_mutex_t # define curl_thread_t pthread_t * @@ -35,6 +36,7 @@ # define Curl_mutex_release(m) pthread_mutex_unlock(m) # define Curl_mutex_destroy(m) pthread_mutex_destroy(m) #elif defined(USE_THREADS_WIN32) +# define CURL_THREAD_RETURN_T DWORD # define CURL_STDCALL WINAPI # define curl_mutex_t CRITICAL_SECTION # define curl_thread_t HANDLE diff --git a/tests/libtest/lib3026.c b/tests/libtest/lib3026.c index f5daaf18ae..d6d9b78ec5 100644 --- a/tests/libtest/lib3026.c +++ b/tests/libtest/lib3026.c @@ -26,7 +26,7 @@ #define NUM_THREADS 100 #ifdef _WIN32 -static CURL_THREAD_RETURN_T WINAPI t3026_run_thread(void *ptr) +static DWORD WINAPI t3026_run_thread(void *ptr) { CURLcode *result = ptr; diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 61dd6bc986..5dd64bee0a 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -412,7 +412,7 @@ struct select_ws_wait_data { HANDLE signal; /* internal event to signal handle trigger */ HANDLE abort; /* internal event to abort waiting threads */ }; -static CURL_THREAD_RETURN_T WINAPI select_ws_wait_thread(void *lpParameter) +static DWORD WINAPI select_ws_wait_thread(void *lpParameter) { struct select_ws_wait_data *data; HANDLE signal, handle, handles[2]; diff --git a/tests/server/util.c b/tests/server/util.c index e26c56d1b6..456b54eb50 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -350,7 +350,7 @@ static SIGHANDLER_T old_sigbreak_handler = SIG_ERR; #endif #if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) -static CURL_THREAD_RETURN_T thread_main_id = 0; +static DWORD thread_main_id = 0; static HANDLE thread_main_window = NULL; static HWND hidden_main_window = NULL; #endif @@ -487,7 +487,7 @@ static LRESULT CALLBACK main_window_proc(HWND hwnd, UINT uMsg, } /* Window message queue loop for hidden main window, details see above. */ -static CURL_THREAD_RETURN_T WINAPI main_window_loop(void *lpParameter) +static DWORD WINAPI main_window_loop(void *lpParameter) { WNDCLASS wc; BOOL ret;