You cannot easily interrupt a running function from C; you will need to use signals. By typing Ctrl + C in your program, you must stop calling cURL, but it also kills your default process. To send a signal programmatically, for this you need separate threads or a process.
Depending on the problem you are trying to solve, you can set CURLOPT_TIMEOUT
with curl_easy_setopt
.
source share