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

man curl_global_init(原创)的更多相关文章

  1. 【原创分享·支付宝支付】HBuilder打包APP调用支付宝客户端支付

    前言 最近有点空余时间,所以,就研究了一下APP支付.前面很早就搞完APP的微信支付了,但是由于时间上和应用上的情况,支付宝一直没空去研究.然后等我空了的时候,发现支付宝居然升级了支付逻辑,虽然目前还 ...

  2. 【原创分享·微信支付】C# MVC 微信支付教程系列之现金红包

            微信支付教程系列之现金红包           最近最弄这个微信支付的功能,然后扫码.公众号支付,这些都做了,闲着无聊,就看了看微信支付的其他功能,发现还有一个叫“现金红包”的玩意,想 ...

  3. 【原创分享·微信支付】 C# MVC 微信支付教程系列之扫码支付

    微信支付教程系列之扫码支付                  今天,我们来一起探讨一下这个微信扫码支付.何为扫码支付呢?这里面,扫的码就是二维码了,就是我们经常扫一扫的那种二维码图片,例如,我们自己添 ...

  4. 【原创分享·微信支付】 C# MVC 微信支付教程系列之公众号支付

    微信支付教程系列之公众号支付         今天,我们接着讲微信支付的系列教程,前面,我们讲了这个微信红包和扫码支付.现在,我们讲讲这个公众号支付.公众号支付的应用环境常见的用户通过公众号,然后再通 ...

  5. 【原创分享·微信支付】C# MVC 微信支付之微信模板消息推送

    微信支付之微信模板消息推送                    今天我要跟大家分享的是“模板消息”的推送,这玩意呢,你说用途嘛,那还是真真的牛逼呐.原因在哪?就是因为它是依赖微信生存的呀,所以他能不 ...

  6. [原创]java使用JDBC向MySQL数据库批次插入10W条数据测试效率

    使用JDBC连接MySQL数据库进行数据插入的时候,特别是大批量数据连续插入(100000),如何提高效率呢?在JDBC编程接口中Statement 有两个方法特别值得注意:通过使用addBatch( ...

  7. GJM : C#设计模式汇总整理——导航 【原创】

    感谢您的阅读.喜欢的.有用的就请大哥大嫂们高抬贵手"推荐一下"吧!你的精神支持是博主强大的写作动力以及转载收藏动力.欢迎转载! 版权声明:本文原创发表于 [请点击连接前往] ,未经 ...

  8. 信息安全-5:RSA算法详解(已编程实现)[原创]

    转发注明出处:http://www.cnblogs.com/0zcl/p/6120389.html 背景介绍 1976年以前,所有的加密方法都是同一种模式: (1)甲方选择某一种加密规则,对信息进行加 ...

  9. Atitit.你这些项目不都是模板吗?不是原创  集成和整合的方式大总结

    Atitit.你这些项目不都是模板吗?不是原创  集成和整合的方式大总结 1.1. 乔布斯的名言:创新即整合(Creativity is just connecting things).1 1.2. ...

随机推荐

  1. Linux设计准则

     计算机体系结构: 运算器 控制器 存储器,内存,编址 输出设备 输入设备 Linux内核功能: 进程管理内存管理文件系统网络功能硬件驱动安全机制 Linux的基本原则: 1.由目的单一的小程序组成: ...

  2. js事件冒泡和事件捕获

    事件捕获当你使用事件捕获时,父级元素先触发,子级元素后触发,即div先触发,p后触发.事件冒泡当你使用事件冒泡时,子级元素先触发,父级元素后触发,即p先触发,div后触发.W3C模型W3C模型是将两者 ...

  3. codeforces 689 E. Mike and Geometry Problem 组合数学 优先队列

    给定一个函数: f([l,r]) = r - l + 1; f(空集) = 0; 即f函数表示闭区间[l,r]的整点的个数 现在给出n个闭区间,和一个数k 从n个区间里面拿出k个区间,然后对这k个区间 ...

  4. [Mongodb]3.2版本的一些基本操作--待续

    一.缘由 今天公司测试股票交易系统,需要拉取大量的数据存放,故考虑放在mongodb里. 二.一些基本操作 1.权限管理 mongo默认是不用账号就能登陆的,默认端口27017,但是这不太安全.我们要 ...

  5. CORBA GIOP消息格式学习

    想要深入理解ORB的工作过程与原理,学习与了解GIOP消息格式必不可少.我们知道GIOP是独立于具体通信的更高级别的抽象,因此这里针对GIOP在TCP/IP上的实现IIOP协议进行学习与分析(IIOP ...

  6. 源码阅读笔记 - 1 MSVC2015中的std::sort

    大约寒假开始的时候我就已经把std::sort的源码阅读完毕并理解其中的做法了,到了寒假结尾,姑且把它写出来 这是我的第一篇源码阅读笔记,以后会发更多的,包括算法和库实现,源码会按照我自己的代码风格格 ...

  7. Java中Enum类型的序列化(转)

    在Java中,对Enum类型的序列化与其他对象类型的序列化有所不同,今天就来看看到底有什么不同.下面先来看下在Java中,我们定义的Enum在被编译之后是长成什么样子的. Java代码: Java代码 ...

  8. HttpWebRequest.GetResponse 方法 转载

    GetResponse 方法返回包含来自 Internet 资源的响应的 WebResponse 对象. 实际返回的实例是 HttpWebResponse,并且能够转换为访问 HTTP 特定的属性的类 ...

  9. eclipse中提示HttpServletRequest不能引用的解决办法

    两种解决方法: 1.右键点击项目->Build Path->Add Libraries..->Server Runtime 选择Apache Tomcat v8.0 2.右键点击项目 ...

  10. 一、Maya API简介

    #include <maya/MSimple.h> #include <maya/MIOStream.h> DeclareSimpleCommand( hello, " ...