CURLOPT_QUICK_EXIT.md (1325B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_QUICK_EXIT 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_FAILONERROR (3) 9 - CURLOPT_RESOLVE (3) 10 Protocol: 11 - All 12 Added-in: 7.87.0 13 --- 14 15 # NAME 16 17 CURLOPT_QUICK_EXIT - allow libcurl to exit quickly 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUICK_EXIT, 25 long value); 26 ~~~ 27 28 # DESCRIPTION 29 30 Pass a long as a parameter, 1L meaning that when recovering from a timeout, 31 libcurl should skip lengthy cleanups that are intended to avoid all kinds of 32 leaks (threads etc.), as the caller program is about to call exit() anyway. 33 This allows for a swift termination after a DNS timeout for example, by 34 canceling and/or forgetting about a resolver thread, at the expense of a 35 possible (though short-lived) leak of associated resources. 36 37 # DEFAULT 38 39 0 40 41 # %PROTOCOLS% 42 43 # EXAMPLE 44 45 ~~~c 46 int 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 61 curl_easy_setopt(3) returns a CURLcode indicating success or error. 62 63 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 64 libcurl-errors(3).