mirror of
https://github.com/curl/curl.git
synced 2026-08-26 02:13:33 +03:00
badwords: catch and fix threading-related words
Also: - sync newlines between the two threaded examples. Closes #20001
This commit is contained in:
parent
8dadff9434
commit
61273f5812
25 changed files with 45 additions and 38 deletions
2
docs/examples/.gitignore
vendored
2
docs/examples/.gitignore
vendored
|
|
@ -79,7 +79,6 @@ multi-legacy
|
|||
multi-post
|
||||
multi-single
|
||||
multi-uv
|
||||
multithread
|
||||
netrc
|
||||
parseurl
|
||||
persistent
|
||||
|
|
@ -123,6 +122,7 @@ smtp-tls
|
|||
smtp-vrfy
|
||||
sslbackend
|
||||
synctime
|
||||
threaded
|
||||
threaded-ssl
|
||||
unixsocket
|
||||
url2file
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ check_PROGRAMS = \
|
|||
COMPLICATED_MAY_BUILD = \
|
||||
cacertinmem.c \
|
||||
multi-uv.c \
|
||||
multithread.c \
|
||||
sessioninfo.c \
|
||||
threaded.c \
|
||||
threaded-ssl.c \
|
||||
usercertinmem.c
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ static int my_trace(CURL *curl, curl_infotype type,
|
|||
known_offset = 1;
|
||||
}
|
||||
secs = epoch_offset + tv.tv_sec;
|
||||
now = localtime(&secs); /* not thread safe but we do not care */
|
||||
now = localtime(&secs); /* not thread-safe but we do not care */
|
||||
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
|
||||
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
/* <DESC>
|
||||
* A multi threaded application that uses a progress bar to show
|
||||
* status. It uses Gtk+ to make a smooth pulse.
|
||||
* A multi-threaded application that uses a progress bar to show
|
||||
* status. It uses Gtk+ to make a smooth pulse.
|
||||
* </DESC>
|
||||
*/
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
/* A multi-threaded example that uses pthreads and fetches 4 remote files at
|
||||
* once over HTTPS.
|
||||
*
|
||||
* Recent versions of OpenSSL and GnuTLS are thread safe by design, assuming
|
||||
* Recent versions of OpenSSL and GnuTLS are thread-safe by design, assuming
|
||||
* support for the underlying OS threading API is built-in. Older revisions
|
||||
* of this example demonstrated locking callbacks for the SSL library, which
|
||||
* are no longer necessary. An older revision with callbacks can be found at
|
||||
|
|
@ -40,7 +40,9 @@
|
|||
/* Also requires TLS support to run */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#define NUMT 4
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ int main(void)
|
|||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ If this is not thread-safe, you must not call this function when any other
|
|||
thread in the program (i.e. a thread sharing the same memory) is running.
|
||||
This does not just mean no other thread that is using libcurl. Because
|
||||
curl_global_cleanup(3) calls functions of other libraries that are
|
||||
similarly thread unsafe, it could conflict with any other thread that uses
|
||||
similarly thread-unsafe, it could conflict with any other thread that uses
|
||||
these other libraries.
|
||||
|
||||
See the description in libcurl(3) of global environment requirements for
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ If this is not thread-safe (the bit mentioned above is not set), you must not
|
|||
call this function when any other thread in the program (i.e. a thread sharing
|
||||
the same memory) is running. This does not just mean no other thread that is
|
||||
using libcurl. Because curl_global_init(3) calls functions of other libraries
|
||||
that are similarly thread unsafe, it could conflict with any other thread that
|
||||
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 initialize
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ If this is not thread-safe, you must not call this function when any other
|
|||
thread in the program (i.e. a thread sharing the same memory) is running. This
|
||||
does not just mean no other thread that is using libcurl. Because
|
||||
curl_global_init(3) may call functions of other libraries that are similarly
|
||||
thread unsafe, it could conflict with any other thread that uses these other
|
||||
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 initialize
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ libcurl-thread - libcurl thread safety
|
|||
|
||||
# Multi-threading with libcurl
|
||||
|
||||
libcurl is thread safe but has no internal thread synchronization. You may have
|
||||
libcurl is thread-safe but has no internal thread synchronization. You may have
|
||||
to provide your own locking should you meet any of the thread safety exceptions
|
||||
below.
|
||||
|
||||
|
|
@ -84,10 +84,10 @@ the former signal handler while another thread should still ignore it.
|
|||
# Name resolving
|
||||
|
||||
The **gethostbyname** or **getaddrinfo** and other name resolving system
|
||||
calls used by libcurl are provided by your operating system and must be thread
|
||||
safe. It is important that libcurl can find and use thread safe versions of
|
||||
these and other system calls, as otherwise it cannot function fully thread
|
||||
safe. Some operating systems are known to have faulty thread
|
||||
calls used by libcurl are provided by your operating system and must be
|
||||
thread-safe. It is important that libcurl can find and use thread-safe versions
|
||||
of these and other system calls, as otherwise it cannot function fully
|
||||
thread-safe. Some operating systems are known to have faulty thread
|
||||
implementations. We have previously received problem reports on *BSD (at least
|
||||
in the past, they may be working fine these days). Some operating systems that
|
||||
are known to have solid and working thread support are Linux, Solaris and
|
||||
|
|
@ -110,7 +110,7 @@ libcurl(3) section **GLOBAL CONSTANTS**.
|
|||
# Memory functions
|
||||
|
||||
These functions, provided either by your operating system or your own
|
||||
replacements, must be thread safe. You can use curl_global_init_mem(3)
|
||||
replacements, must be thread-safe. You can use curl_global_init_mem(3)
|
||||
to set your own replacement memory functions.
|
||||
|
||||
# Non-safe functions
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ all the details needed to get the file moved from one machine to another.
|
|||
|
||||
# Multi-threading Issues
|
||||
|
||||
libcurl is thread safe but there are a few exceptions. Refer to
|
||||
libcurl is thread-safe but there are a few exceptions. Refer to
|
||||
libcurl-thread(3) for more information.
|
||||
|
||||
# When It does not Work
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ the same, on any of the platforms it compiles and builds on.
|
|||
|
||||
# THREADS
|
||||
|
||||
libcurl is thread safe but there are a few exceptions. Refer to
|
||||
libcurl is thread-safe but there are a few exceptions. Refer to
|
||||
libcurl-thread(3) for more information.
|
||||
|
||||
# PERSISTENT CONNECTIONS
|
||||
|
|
@ -176,7 +176,7 @@ The global constant functions are thread-safe since libcurl 7.84.0 if
|
|||
curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set
|
||||
(most platforms). Read libcurl-thread(3) for thread safety guidelines.
|
||||
|
||||
If the global constant functions are *not thread safe*, then you must
|
||||
If the global constant functions are *not thread-safe*, then you must
|
||||
not call them when any other thread in the program is running. It
|
||||
is not good enough that no other thread is using libcurl at the time,
|
||||
because these functions internally call similar functions of other
|
||||
|
|
@ -184,7 +184,7 @@ libraries, and those functions are similarly thread-unsafe. You cannot
|
|||
generally know what these libraries are, or whether other threads are
|
||||
using them.
|
||||
|
||||
If the global constant functions are *not thread safe*, then the basic rule
|
||||
If the global constant functions are *not thread-safe*, then the basic rule
|
||||
for constructing a program that uses libcurl is this: Call
|
||||
curl_global_init(3), with a *CURL_GLOBAL_ALL* argument, immediately
|
||||
after the program starts, while it is still only one thread and before it uses
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int main(void)
|
|||
if(curl) {
|
||||
CURLcode ret;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
/* switch off the use of a global, thread unsafe, cache */
|
||||
/* switch off the use of a global, thread-unsafe, cache */
|
||||
curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE, 0L);
|
||||
ret = curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue