mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
asyn-thrdd: drop pthread_cancel
Remove use of pthread_cancel in asnyc threaded resolving. While there are system where this works, others might leak to resource leakage (memory, files, etc.). The popular nsswitch is one example where resolve code can be dragged in that is not prepared. The overall promise and mechanism of pthread_cancel() is just too brittle and the historcal design of getaddrinfo() continues to haunt us. Fixes #18532 Reported-by: Javier Blazquez Closes #18540
This commit is contained in:
parent
f7cac7cc07
commit
de3fc1d7ad
10 changed files with 16 additions and 217 deletions
|
|
@ -66,22 +66,6 @@ void Curl_thread_destroy(curl_thread_t *hnd);
|
|||
|
||||
int Curl_thread_join(curl_thread_t *hnd);
|
||||
|
||||
int Curl_thread_cancel(curl_thread_t *hnd);
|
||||
|
||||
#if defined(USE_THREADS_POSIX) && defined(PTHREAD_CANCEL_ENABLE)
|
||||
#define Curl_thread_push_cleanup(a,b) pthread_cleanup_push(a,b)
|
||||
#define Curl_thread_pop_cleanup() pthread_cleanup_pop(0)
|
||||
#define Curl_thread_enable_cancel() \
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)
|
||||
#define Curl_thread_disable_cancel() \
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL)
|
||||
#else
|
||||
#define Curl_thread_push_cleanup(a,b) ((void)a,(void)b)
|
||||
#define Curl_thread_pop_cleanup() Curl_nop_stmt
|
||||
#define Curl_thread_enable_cancel() Curl_nop_stmt
|
||||
#define Curl_thread_disable_cancel() Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */
|
||||
|
||||
#endif /* HEADER_CURL_THREADS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue