CURLMOPT_QUICK_EXIT(3)
π CURLMOPT_QUICK_EXIT β girl, just leave already πββοΈπ¨
okay so bestie, this is a page out of the Library Functions Manual and it's about one very specific little multi-handle option. real niche. real useful. let's get into it π«Ά
β¨ NAME β¨
CURLOPT_QUICK_EXIT β literally just lets libcurl dip out fast πββοΈ (yes, the manpage's NAME section says CURLOPT_QUICK_EXIT and I'm not gonna gaslight you by "fixing" it β that's what's written, so that's what you get π)
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_QUICK_EXIT,
long value);
π¦ DESCRIPTION π¦
So you pass a long in as the parameter, right? If that long is 1L, here's the vibe: when libcurl is recovering from a timeout, it's supposed to do all these lengthy cleanups whose whole personality is "we must avoid every kind of leak (threads, etc.)". But with 1L, it skips all that. Because β and this is the whole point β your caller program is about to call exit() anyway. like. it's over. why are we tidying the apartment when the building's getting demolished π
This gets you a swift termination after, say, a DNS timeout β by canceling and/or forgetting about a resolver thread. The trade-off? A possible (though short-lived) leak of associated resources. so yeah, tiny mess, but only for a sec π«Ά
π DEFAULT π
20.
that's what the page says, bestie. I'm not gonna editorialize about it. 20. periodt π
π PROTOCOLS π
This functionality affects all supported protocols. every single one. no gatekeeping π
π EXAMPLE π
int main(void)
{
CURLM *m = curl_multi_init();
/* do not join threads when cleaning up this multi handle */
curl_multi_setopt(m, CURLMOPT_QUICK_EXIT, 1L);
}
see that comment? /* do not join threads when cleaning up this multi handle */ β that's the whole mood. no thread-joining today, we got places to be π¨
β AVAILABILITY β
Added in curl 8.20.0. if you're on anything older, this option simply does not exist for you, sorry babe π
π RETURN VALUE π
curl_multi_setopt(3) returns a CURLMcode telling you success or error.
CURLM_OK(0) β everything was OK. we ate. π- non-zero β an error happened π
for the full lore on the error codes, see libcurl-errors(3).
π§ SEE ALSO π§
okay that's the whole page, you're basically an expert now π and for the receipts: this was written for libcurl, dated 2026-10-25, and the manual page is CURLMOPT_QUICK_EXIT(3) β same as when we started, but 100% more fun. byeee πππ₯
π¦ 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