curl_global_init(3)             libcurl 手册             curl_global_init(3)

名称

curl_global_init - libcurl库全局的初始化

概要

#include <curl/curl.h>

CURLcode curl_global_init(long flags);

描述

在调应libcurl库中其他函数之前,必须先调用这个函数对编程环境进行相应的初始化,使每个程序调用libcurl库函数都具有相同的效果。

这个按位组合选择的整形(int)变量可以精确告诉libcurl当下的需要的工作模式。详细情况,如果你不是十分熟悉整体参数的初始化,您可以设置参数为CURL_GLOABL_ALL。对所有的需要用到的环境进行初始化,这个函数不是安全线程,在多线程应用中,需要在主线程中调用这个函数。这个函数设置libcurl所需的环境。通常情况,如果不显式的调用它,第一次调用 curl_easy_init()时,curl_easy_init 会调用 curl_global_init,在单线程环境下,这不是问题。但是多线程下就不行了,因为curl_global_init不是线程安全的。在多个线 程中调用curl_easy_int,然后如果两个线程同时发现curl_global_init还没有被调用,同时调用 curl_global_init,悲剧就发生了。这种情况发生的概率很小,但可能性是存在的。

看到libcurl的描述(3)的全局环境要求的细节如何使用这个函数。

标志

CURL_GLOBAL_ALL

初始化所有已知设置,除了后台传输服务。CURL_GLOBAL_ACK_EINTR.

CURL_GLOBAL_SSL

初始化 SSL(安全套接层)

CURL_GLOBAL_WIN32

初始化Win32 所以共享函数包.

CURL_GLOBAL_NOTHING

什么都不初始化This sets no bit.

CURL_GLOBAL_DEFAULT

一个合理的默认值。它将init SSL和Win32。现在,这个等于CURL_GLOBAL_ALL面具的功能。

CURL_GLOBAL_ACK_EINTR

这个标志被设置时,旋度承认当连接或在等待数据捕获条件。否则,旋度等待超时白白的流逝了。在7.30.0(添加)

返回值

如果这个函数返回非零,出了意外,你不能使用其他旋度函数。

另请参阅

curl_global_init_mem(3),    curl_global_cleanup(3),   curl_easy_init(3),  libcurl(3)

libcurl 7.12                    11 May 2004                         curl_global_init(3)

curl_global_init()             libcurl Manual             curl_global_init()

NAME
curl_global_init - Global libcurl initialisation SYNOPSIS
#include <curl/curl.h> CURLcode curl_global_init(long flags); DESCRIPTION
This function sets up the program environment that libcurl needs.
Think of it as an extension of the library loader. This function must be called at least once within a program (a program
is all the code that shares a memory space) before the program calls
any other function in libcurl. The environment it sets up is constant
for the life of the program and is the same for every program, so mul‐
tiple calls have the same effect as one call. The flags option is a bit pattern that tells libcurl exactly what fea‐
tures to init, as described below. Set the desired bits by ORing the
values together. In normal operation, you must specify
CURL_GLOBAL_ALL. Don't use any other value unless you are familiar
with it and mean to control internal operations of libcurl. 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 run‐
ning. This doesn't just mean no other thread that is using libcurl.
Because curl_global_init() calls functions of other libraries that are
similarly thread unsafe, it could conflict with any other thread that
uses these other libraries. If you are initializing libcurl from a Windows DLL you should not ini‐
tialize it from DllMain or a static initializer because Windows holds
the loader lock during that time and it could cause a deadlock. See the description in libcurl() of global environment requirements
for details of how to use this function. FLAGS
CURL_GLOBAL_ALL
Initialize everything possible. This sets all known bits except
CURL_GLOBAL_ACK_EINTR. CURL_GLOBAL_SSL
Initialize SSL CURL_GLOBAL_WIN32
Initialize the Win32 socket libraries. CURL_GLOBAL_NOTHING
Initialise nothing extra. This sets no bit. CURL_GLOBAL_DEFAULT
A sensible default. It will init both SSL and Win32. Right now,
this equals the functionality of the CURL_GLOBAL_ALL mask. CURL_GLOBAL_ACK_EINTR
When this flag is set, curl will acknowledge EINTR condition when
connecting or when waiting for data. Otherwise, curl waits until
full timeout elapses. (Added in 7.30.) RETURN VALUE
If this function returns non-zero, something went wrong and you cannot
use the other curl functions. SEE ALSO
curl_global_init_mem(), curl_global_cleanup(), curl_easy_init()
libcurl() libcurl 7.12 May curl_global_init()

最新文章

  1. java是值传递还是引用传递
  2. C# 计算字符串在控制台中的显示长度
  3. 精品资源:40个实用的 PSD 贴纸模板《下篇》
  4. 菜鸟学Linux命令:nohup命令启动程序
  5. Spring的注入问题
  6. 使用PS3手柄在PC玩Unity3D游戏
  7. Gmail邮箱添加域名解析
  8. thinkPHP add、save无法添加、修改不起作用
  9. python用法——Mixin
  10. 闲扯 Javascript 00
  11. SQLServer通过链接服务器远程删除数据性能问题解决
  12. 扩展kmp——原创
  13. Spring Boot简单xml配置集成mybatis
  14. Unresolved reference issue in PyCharm
  15. 如何设置PDF签名文档,PDF签名文档怎么编辑
  16. matplotlib 三维旋转
  17. MyBatis Generator 生成数据库自带中文注释
  18. Java – How to convert a primitive Array to List
  19. Java Internet
  20. docker学习-docker解决了什么问题

热门文章

  1. 20160113 JS中CheckBox如何控制全选
  2. mysql系统库INFORMATION_SCHEMA,MySQL,TEST,mysql系统表的作用
  3. IntelliJ 2016.02设置maven 阿里云加速
  4. [solr] - Facet - autocomplete
  5. C# :GDI+技术生成复杂型彩色验证码(转载)
  6. node.js和express.js安装和使用步骤 [windows]
  7. LVS+Keepalived负载均衡配置
  8. python---生成随机密码
  9. Hadoop学习15--编程相关
  10. Chrome 调试动态加载的js