curl/docs/libcurl
Stefan Eissing 82009c4220
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
2026-03-21 14:42:49 +01:00
..
opts docs: enable more compiler warnings for C snippets, fix 3 finds 2026-03-19 14:21:53 +01:00
.gitignore gitignore: the generated libcurl-symbols.md 2024-01-25 16:34:06 +01:00
ABI.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
CMakeLists.txt cmake: fix building docs when the base directory contains .3 2025-09-16 12:37:11 +02:00
curl_easy_cleanup.md docs: compare result against literal CURLE_OK (where missing) 2026-02-07 19:40:45 +01:00
curl_easy_duphandle.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_escape.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_easy_getinfo.md docs: fixup wording nits 2026-03-09 22:47:07 +01:00
curl_easy_header.md tidy-up: miscellaneous 2026-03-09 11:35:19 +01:00
curl_easy_init.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_nextheader.md curl_easy_nextheader.md: a new transfer invalidates 'prev' 2026-01-13 14:11:15 +01:00
curl_easy_option_by_id.md docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
curl_easy_option_by_name.md docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
curl_easy_option_next.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_easy_pause.md tidy-up: miscellaneous 2026-03-09 11:35:19 +01:00
curl_easy_perform.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_recv.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_reset.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_easy_send.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_setopt.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_easy_ssls_export.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_easy_ssls_import.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_strerror.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_easy_unescape.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_easy_upkeep.md mqtt: send ping at upkeep interval 2025-04-16 09:36:19 +02:00
curl_escape.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_formadd.md badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
curl_formfree.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
curl_formget.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
curl_free.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
curl_getdate.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_getenv.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_global_cleanup.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_global_init.md docs: handle error in curl_global_init* examples 2026-03-09 13:01:22 +01:00
curl_global_init_mem.md docs: fixup wording nits 2026-03-09 22:47:07 +01:00
curl_global_sslset.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_global_trace.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_mime_addpart.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_mime_data.md tidy-up: miscellaneous 2026-02-25 14:44:56 +01:00
curl_mime_data_cb.md docs: enable more compiler warnings for C snippets, fix 3 finds 2026-03-19 14:21:53 +01:00
curl_mime_encoder.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mime_filedata.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mime_filename.md badwords: fix typos found 2026-01-14 03:11:33 +01:00
curl_mime_free.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_mime_headers.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mime_init.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_mime_name.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mime_subparts.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mime_type.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_mprintf.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_add_handle.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_multi_assign.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_cleanup.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_multi_fdset.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_multi_get_handles.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_multi_get_offt.md curl_multi_get_offt: language fix 2025-08-05 11:48:31 +02:00
curl_multi_info_read.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_init.md docs/libcurl: expand multi documentation 2024-10-01 15:17:17 +02:00
curl_multi_notify_disable.md multi: use CURLMNOTIFY_ as notification id prefix 2025-10-07 17:18:05 +02:00
curl_multi_notify_enable.md multi: use CURLMNOTIFY_ as notification id prefix 2025-10-07 17:18:05 +02:00
curl_multi_perform.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_poll.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_multi_remove_handle.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_setopt.md multi: add notifications API 2025-10-07 10:55:31 +02:00
curl_multi_socket.md docs/libcurl: make examples build with picky compiler options 2025-04-11 15:23:51 +02:00
curl_multi_socket_action.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_multi_socket_all.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_strerror.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_multi_timeout.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_wait.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_multi_waitfds.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_multi_wakeup.md docs: use mresult as variable name for CURLMcode 2025-12-17 08:55:12 +01:00
curl_pushheader_byname.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_pushheader_bynum.md tidy-up: miscellaneous 2026-03-09 11:35:19 +01:00
curl_share_cleanup.md share: concurrency handling, easy updates 2026-03-21 14:42:49 +01:00
curl_share_init.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_share_setopt.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_share_strerror.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_slist_append.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_slist_free_all.md docs/libcurl: make examples build with picky compiler options 2025-04-11 15:23:51 +02:00
curl_strequal.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_strnequal.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_unescape.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_url.md doc: some returned in-memory data may not be altered 2025-11-25 11:05:27 +01:00
curl_url_cleanup.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
curl_url_dup.md docs/libcurl: return value overhall 2025-01-02 16:58:05 +01:00
curl_url_get.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_url_set.md urlapi: allow more path characters "raw" when asked to URL encode 2025-08-01 23:22:32 +02:00
curl_url_strerror.md curldown: fixups 2024-07-19 17:03:25 +02:00
curl_version.md curl_version_info.md: clarify ssl_version for MultiSSL 2025-05-11 12:23:36 -04:00
curl_version_info.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
curl_ws_meta.md docs/libcurl: fix C formatting nits 2025-12-04 22:49:03 +01:00
curl_ws_recv.md docs: enable more compiler warnings for C snippets, fix 3 finds 2026-03-19 14:21:53 +01:00
curl_ws_send.md docs: rename CURLcode variables to 'result' 2025-12-17 08:55:12 +01:00
curl_ws_start_frame.md docs: avoid starting sentences with However, 2026-03-07 23:49:11 +01:00
libcurl-easy.md curldown: make 'added-in:' a mandatory header field 2024-07-18 18:04:09 +02:00
libcurl-env-dbg.md easy: reset errorbuf on eyeballing success 2026-02-18 12:04:23 +01:00
libcurl-env.md netrc: use the NETRC environment variable (first) if set 2025-07-27 18:26:43 +02:00
libcurl-errors.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
libcurl-multi.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
libcurl-security.md docs: avoid starting sentences with However, 2026-03-07 23:49:11 +01:00
libcurl-share.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
libcurl-thread.md badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
libcurl-tutorial.md badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
libcurl-url.md stop using the word 'just' 2026-03-03 15:30:22 +01:00
libcurl-ws.md websocket: support CURLOPT_READFUNCTION 2025-08-11 23:28:54 +02:00
libcurl.m4 stop using the word 'just' 2026-03-03 15:30:22 +01:00
libcurl.md badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
Makefile.am tests: always make bundles, adapt build and tests 2025-06-14 21:08:23 +02:00
Makefile.inc tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
mksymbolsmanpage.pl scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
symbols-in-versions curl.h: remove CURLPROTO_MQTTS from the public header 2026-03-03 23:14:34 +01:00
symbols.pl tidy-up: miscellaneous 2026-02-25 14:44:56 +01:00