mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
asyn-thrdd: manage DEFERRED and locks better
- cancel thread waits until thread start is at least 5ms in the past to give it some time to get its cancellation setup in place - cancel thread without holding the mutex. It's supposed to be an async operation, but better be safe - set DEFERRED cancel state explicitly, should be default in a pthread, but better be safe Closes #18350
This commit is contained in:
parent
f5ee566dbc
commit
a8d20cd223
3 changed files with 58 additions and 55 deletions
|
|
@ -75,11 +75,14 @@ int Curl_thread_cancel(curl_thread_t *hnd);
|
|||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)
|
||||
#define Curl_thread_disable_cancel() \
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL)
|
||||
#define Curl_thread_cancel_deferred() \
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 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
|
||||
#define Curl_thread_cancel_deferred() Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue