1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_QUICK_EXIT
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_FAILONERROR (3)
9  - CURLOPT_RESOLVE (3)
10Protocol:
11  - All
12Added-in: 7.87.0
13---
14
15# NAME
16
17CURLOPT_QUICK_EXIT - allow to exit quickly
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUICK_EXIT,
25                          long value);
26~~~
27
28# DESCRIPTION
29
30Pass a long as a parameter, 1L meaning that when recovering from a timeout,
31libcurl should skip lengthy cleanups that are intended to avoid all kinds of
32leaks (threads etc.), as the caller program is about to call exit() anyway.
33This allows for a swift termination after a DNS timeout for example, by
34canceling and/or forgetting about a resolver thread, at the expense of a
35possible (though short-lived) leak of associated resources.
36
37# DEFAULT
38
390
40
41# %PROTOCOLS%
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    CURLcode ret;
51    curl_easy_setopt(curl, CURLOPT_QUICK_EXIT, 1L);
52    ret = curl_easy_perform(curl);
53  }
54}
55~~~
56
57# %AVAILABILITY%
58
59# RETURN VALUE
60
61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
62