mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
share: concurrency handling, easy updates
Replace the `volatile int dirty` with a reference counter protected by a mutex when available. Solve the problem of when to call application's lock function by adding a volatile flag that indicates a share has been added to easy handles in its lifetime. That flag ever goes from FALSE to TRUE, so volatile might work (in the absence of a mutex). (The problem is that the lock/unlock functions need 2-3 `curl_share_setopt()` invocations to become usable and there is no way of telling if the third will ever happen. Calling the lock function before the 3rd setopt may crash the application.) When removing a share from an easy handle (or replacing it with another share), detach the easy connection on a share with a connection pool. When cleaning up a share, allow this even if it is still used in easy handles. It will be destroyed when the reference count drops to 0. Closes #20870
This commit is contained in:
parent
745344ea4e
commit
82009c4220
26 changed files with 378 additions and 210 deletions
|
|
@ -85,7 +85,8 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
|
|||
#endif /* CURLRES_SYNCH */
|
||||
#endif /* CURLRES_IPV4 */
|
||||
|
||||
#if defined(CURLRES_IPV4) && !defined(CURLRES_ARES) && !defined(CURLRES_AMIGA)
|
||||
#if defined(CURLRES_IPV4) && !defined(USE_RESOLV_ARES) && \
|
||||
!defined(CURLRES_AMIGA)
|
||||
|
||||
/*
|
||||
* Curl_ipv4_resolve_r() - ipv4 thread-safe resolver function.
|
||||
|
|
@ -277,4 +278,4 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||
|
||||
return ai;
|
||||
}
|
||||
#endif /* CURLRES_IPV4 && !CURLRES_ARES && !CURLRES_AMIGA */
|
||||
#endif /* CURLRES_IPV4 && !USE_RESOLV_ARES && !CURLRES_AMIGA */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue