1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

curl_global_cleanup and curl_global_init added to the family

This commit is contained in:
Daniel Stenberg 2001-05-28 14:11:02 +00:00
parent 81da4fc995
commit a9d0a85842
4 changed files with 70 additions and 14 deletions

View File

@ -24,6 +24,8 @@ man_MANS = \
curl_strequal.3 \ curl_strequal.3 \
curl_strnequal.3 \ curl_strnequal.3 \
curl_mprintf.3 \ curl_mprintf.3 \
curl_global_init.3 \
curl_global_cleanup.3 \
libcurl.5 libcurl.5
EXTRA_DIST = $(man_MANS) \ EXTRA_DIST = $(man_MANS) \

View File

@ -0,0 +1,25 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_global_cleanup 3 "28 May 2001" "libcurl 7.8" "libcurl Manual"
.SH NAME
curl_global_cleanup - Global libcurl cleanup
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "void curl_global_cleanup(void);"
.ad
.SH DESCRIPTION
curl_global_cleanup must be called once (no matter how many threads or libcurl
sessions that'll be used) by every application that uses libcurl, after all
uses of libcurl is complete.
This is the opposite of \fIcurl_global_init\fP.
Not calling this function may result in memory leaks.
.SH "SEE ALSO"
.BR curl_global_init "(3), "
.SH BUGS
None?

29
docs/curl_global_init.3 Normal file
View File

@ -0,0 +1,29 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_global_init 3 "28 May 2001" "libcurl 7.8" "libcurl Manual"
.SH NAME
curl_global_init - Global libcurl initialisation
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "CURLcode curl_global_init(void);"
.ad
.SH DESCRIPTION
This function should be called once (no matter how many threads or libcurl
sessions that'll be used) by every application that uses libcurl.
If this function hasn't been invoked when \fIcurl_easy_init\fP is called, it
will be done automatically by libcurl.
You must however \fBalways\fP use the \fIcurl_global_cleanup\fP function, as
that cannot be called automatically for you by libcurl.
.SH RETURN VALUE
If this function returns non-zero, something went wrong and you cannot use the
other curl functions.
.SH "SEE ALSO"
.BR curl_global_cleanup "(3), "
.SH BUGS
None.

View File

@ -2,7 +2,7 @@
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by Daniel Stenberg .\" Written by Daniel Stenberg
.\" .\"
.TH libcurl 5 "15 May 2001" "libcurl 7.7.3" "libcurl overview" .TH libcurl 5 "28 May 2001" "libcurl 7.8" "libcurl overview"
.SH NAME .SH NAME
libcurl \- client-side URL transfers libcurl \- client-side URL transfers
.SH DESCRIPTION .SH DESCRIPTION
@ -12,30 +12,30 @@ specific man pages for each function mentioned in here.
libcurl can also be used directly from within your Java, PHP, Perl, Ruby or libcurl can also be used directly from within your Java, PHP, Perl, Ruby or
Tcl programs as well, look elsewhere for documentation on this! Tcl programs as well, look elsewhere for documentation on this!
When using libcurl's easy interface, you init your session and get a handle, All applications that use libcurl should call \fIcurl_global_init()\fP exactly
which you use as input to the following interface functions you use. Use once before any libcurl function can be used. After all usage of libcurl is
.B curl_easy_init() complete, it \fBmust\fP call \fIcurl_global_cleanup()\fP. In between those two
calls, you can use libcurl as described below.
When using libcurl you init your session and get a handle, which you use as
input to the following interface functions you use. Use \fIcurl_easy_init()\fP
to get the handle. to get the handle.
You continue by setting all the options you want in the upcoming transfer, You continue by setting all the options you want in the upcoming transfer,
most important among them is the URL itself (you can't transfer anything most important among them is the URL itself (you can't transfer anything
without a specified URL as you may have figured out yourself). You might want without a specified URL as you may have figured out yourself). You might want
to set some callbacks as well that will be called from the library when data to set some callbacks as well that will be called from the library when data
is available etc. is available etc. \fIcurl_easy_setopt()\fP is there for this.
.B curl_easy_setopt()
is there for this.
When all is setup, you tell libcurl to perform the transfer using When all is setup, you tell libcurl to perform the transfer using
.B curl_easy_perform(). \fIcurl_easy_perform()\fP. It will then do the entire operation and won't
It will then do the entire operation and won't return until it is done return until it is done (successfully or not).
(successfully or not).
After the transfer has been made, you can set new options and make another After the transfer has been made, you can set new options and make another
transfer, or if you're done, cleanup the session by calling transfer, or if you're done, cleanup the session by calling
.B curl_easy_cleanup(). \fIcurl_easy_cleanup()\fP. If you want persistant connections, you don't
If you want persistant connections, you don't cleanup immediately, but instead cleanup immediately, but instead run ahead and perform other transfers using
run ahead and perform other transfers using the same handle. See the chapter the same handle. See the chapter below for Persistant Connections.
below for Persistant Connections.
There is also a series of other helpful functions to use. They are: There is also a series of other helpful functions to use. They are: