curl/docs/libcurl/opts/CURLMOPT_QUICK_EXIT.md
Stefan Eissing 39036c9021
async-thrdd: use thread queue for resolving
Use a thread queue and pool for asnyc threaded DNS resolves.
Add pytest test_21_* for verification.

Add `CURLMOPT_RESOLVE_THREADS_MAX` to allow applications to
resize the thread pool used.

Add `CURLMOPT_QUICK_EXIT` to allow applications to skip thread
joins when cleaning up a multi handle. Multi handles in
`curl_easy_perform()` inherit this from `CURLOPT_QUICK_EXIT`.

Add several debug environment variables for testing.

Closes #20936
2026-03-25 12:14:21 +01:00

1.3 KiB

c SPDX-License-Identifier Title Section Source See-also Protocol Added-in
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. curl CURLMOPT_QUICK_EXIT 3 libcurl
CURLOPT_QUICK_EXIT (3)
All
8.20.0

NAME

CURLOPT_QUICK_EXIT - allow libcurl to exit quickly

SYNOPSIS

#include <curl/curl.h>

CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_QUICK_EXIT,
                            long value);

DESCRIPTION

Pass a long as a parameter, 1L meaning that when recovering from a timeout, libcurl should skip lengthy cleanups that are intended to avoid all kinds of leaks (threads etc.), as the caller program is about to call exit() anyway. This allows for a swift termination after a DNS timeout for example, by canceling and/or forgetting about a resolver thread, at the expense of a possible (though short-lived) leak of associated resources.

DEFAULT

%PROTOCOLS%

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);
}

%AVAILABILITY%

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, see libcurl-errors(3).