1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_NOSIGNAL
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_TIMEOUT (3)
9---
10
11# NAME
12
13CURLOPT_NOSIGNAL - skip all signal handling
14
15# SYNOPSIS
16
17~~~c
18#include <curl/curl.h>
19
20CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOSIGNAL, long onoff);
21~~~
22
23# DESCRIPTION
24
25If *onoff* is 1, libcurl uses no functions that install signal handlers or
26any functions that cause signals to be sent to the process. This option is
27here to allow multi-threaded unix applications to still set/use all timeout
28options etc, without risking getting signals.
29
30If this option is set and libcurl has been built with the standard name
31resolver, timeouts cannot occur while the name resolve takes place. Consider
32building libcurl with the c-ares or threaded resolver backends to enable
33asynchronous DNS lookups, to enable timeouts for name resolves without the use
34of signals.
35
36Setting CURLOPT_NOSIGNAL(3) to 1 makes libcurl NOT ask the system to
37ignore SIGPIPE signals, which otherwise are sent by the system when trying to
38send data to a socket which is closed in the other end. libcurl makes an
39effort to never cause such SIGPIPE signals to trigger, but some operating
40systems have no way to avoid them and even on those that have there are some
41corner cases when they may still happen, contrary to our desire. In addition,
42using *CURLAUTH_NTLM_WB* authentication could cause a SIGCHLD signal to be
43raised.
44
45# DEFAULT
46
470
48
49# PROTOCOLS
50
51All
52
53# EXAMPLE
54
55~~~c
56int main(void)
57{
58  CURL *curl = curl_easy_init();
59  if(curl) {
60    CURLcode res;
61    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
62
63    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
64
65    res = curl_easy_perform(curl);
66
67    curl_easy_cleanup(curl);
68  }
69}
70~~~
71
72# AVAILABILITY
73
74Added in 7.10
75
76# RETURN VALUE
77
78Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
79