c++中的Curl_easy_perform会停止用于其他用途的计时器

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

本文关键字:其他 用于 计时器 Curl 中的 easy perform c++      更新时间:2023-10-16

当我在我的c程序中使用curl_easy_perform时,它以某种方式停止了我用于检查其他内容的计时器。

这是我的代码:

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);

在没有更多信息的情况下,我猜测curl_easy_perform()会产生一个信号,这会打乱您的计时器。在调用curl_easy_perform():

之前尝试添加这个
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);

告诉curl不要使用任何安装信号处理程序或导致信号发送到进程的函数。参见curl_easy_setopt手册页