libcurl的curl_easy_perform奔溃问题

来源:互联网 发布:linux教学视频百度云 编辑:程序博客网 时间:2024/05/29 09:51

curl_global_init(CURL_GLOBAL_ALL);
curl_global_cleanup();

这两个是libcurl全局函数,负责环境的初始化和清理。

非线程安全,对于多线程来说,请不要再每个线程里都初始化和清理。一个简单的做法是在主线程里初始化和清理。


This function sets up the program environment that libcurl needs. Think of it as an extension of the library loader.


This function is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Becausecurl_global_init calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries.


https://curl.haxx.se/libcurl/c/curl_global_init.html

0 0
原创粉丝点击