简体   繁体   中英

curl_easy_perform in c++ stops a timer used for something else.

When i use curl_easy_perform in my c program it somehow stops a timer I have for checking something else.

this is my code:

curl_easy_setopt(curl, CURLOPT_URL, query.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, changeddata.c_str());
result = curl_easy_perform(curl);

Without more info, I am going to guess that curl_easy_perform() is resulting in a signal, which messes up your timer. Try adding this before calling curl_easy_perform():

curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);

This tells curl not to use any functions that install signal handlers or cause signals to be sent to your process. See the curl_easy_setopt man page .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM