CURLMOPT_R...HREADS_MAX(3)
π CURLMOPT_RESOLVE_THREADS_MAX π
okay bestie so this page is CURLMOPT_R...HREADS_MAX(3) from the Library Functions Manual, and it's genuinely one of those little setting pages that lowkey runs the whole vibe check of your multi handle β¨
πΈ NAME πΈ
CURLMOPT_RESOLVE_THREADS_MAX β the max threads for the threaded DNS resolver, i.e. how many little worker girlies are allowed to be looking up hostnames at once π§
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_RESOLVE_THREADS_MAX,
long amount);
π¦ DESCRIPTION π¦
So you pass a long for the amount, and that number becomes the maximum number of threads used for the threaded DNS resolver. It has to be a positive number in the range of 32 bits, no cap on the drama π
When libcurl is built with a threaded resolver β which is literally the default on many systems, iykyk β it uses a thread pool to look up addresses and other properties of hostnames, so your other transfers don't get blocked by all of that. main character energy, your transfers stay unbothered π
Threads are started on demand to perform the resolving, and then they get shut down again after a period of inactivity. Very "I'll show up when I'm needed, then ghost" of them π«Ά When the maximum number of threads is reached, outstanding resolves get held in a queue and served when a thread becomes available. It's giving waiting room at the salon, no cap.
The default maximum is expected to work fine for many situations, so like, don't stress. But your application may override it using this option for the multi handle β you do you, bestie.
Changing this value while there are resolves in progress is fully possible, which is iconic:
- Increasing the value takes effect right away π₯
- Lowering the value does not close down any resolves, but it ends threads above the new maximum once the resolving is done. So the extra threads finish their homework and then leave respectfully β¨
π DEFAULT π
20.
π PROTOCOLS π
This functionality affects all supported protocols β every single one, periodt π
π EXAMPLE π
int main(void)
{
CURLM *m = curl_multi_init();
/* never use more than 5 threads for resolving */
curl_multi_setopt(m, CURLMOPT_RESOLVE_THREADS_MAX, 5L);
}
β AVAILABILITY β
Added in curl 8.20.0 π
π RETURN VALUE π
curl_multi_setopt(3) returns a CURLMcode indicating success or error.
CURLM_OK (0) means everything was OK π
non-zero means an error occurred, so go check libcurl-errors(3) π
π SEE ALSO π
and that's the whole page, bestie, no cap π¦ this lil writeup is from libcurl, dated 2026-10-25 β go forth and resolve your hostnames with the appropriate amount of threads ππ β¨
π¦ where this page comes from
- alpine 3.23: curl-doc 8.23.0-r0 Β· curl
- alpine 3.24: curl-doc 8.23.0-r0 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms