asyn-thrdd: remove condition variable

Add a flag `thrd_don` to assess if the resolving thread has finished and
only destroy the context when *both* ref_count reaches 0 and thrd_done
is true.

Closes #18345
This commit is contained in:
Stefan Eissing 2025-08-21 21:50:20 +02:00 committed by Daniel Stenberg
parent c83fa990bd
commit 8ebea37eb1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 13 additions and 42 deletions

View file

@ -34,12 +34,6 @@
# define Curl_mutex_acquire(m) pthread_mutex_lock(m)
# define Curl_mutex_release(m) pthread_mutex_unlock(m)
# define Curl_mutex_destroy(m) pthread_mutex_destroy(m)
# define USE_CURL_COND_T
# define curl_cond_t pthread_cond_t
# define Curl_cond_init(c) pthread_cond_init(c, NULL)
# define Curl_cond_destroy(c) pthread_cond_destroy(c)
# define Curl_cond_wait(c, m) pthread_cond_wait(c, m)
# define Curl_cond_signal(c) pthread_cond_signal(c)
#elif defined(USE_THREADS_WIN32)
# define CURL_STDCALL __stdcall
# define curl_mutex_t CRITICAL_SECTION
@ -53,14 +47,6 @@
# define Curl_mutex_acquire(m) EnterCriticalSection(m)
# define Curl_mutex_release(m) LeaveCriticalSection(m)
# define Curl_mutex_destroy(m) DeleteCriticalSection(m)
# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
# define USE_CURL_COND_T
# define curl_cond_t CONDITION_VARIABLE
# define Curl_cond_init(c) InitializeConditionVariable(c)
# define Curl_cond_destroy(c) (void)(c)
# define Curl_cond_wait(c, m) SleepConditionVariableCS(c, m, INFINITE)
# define Curl_cond_signal(c) WakeConditionVariable(c)
# endif
#else
# define CURL_STDCALL
#endif