mirror of
https://github.com/curl/curl.git
synced 2026-07-28 19:23:06 +03:00
examples/threaded-ssl: delete in favor of examples/threaded
After applying a recent fix made to `threaded.c` (formerly `multithread.c`) to `threaded-ssl.c`, syncing and updating comments, the two examples turned out to be identical except their test URLs. Delete one of them to avoid duplication. Also: - examples/threaded: scope a variable. - examples/threaded: merge comments from its deleted sibling. Follow-up to61273f5812#20001 Follow-up to971e8d661c#19526 #19524 Closes #20002
This commit is contained in:
parent
680f050301
commit
e88209da1f
4 changed files with 14 additions and 124 deletions
|
|
@ -25,8 +25,18 @@
|
|||
* A multi-threaded program using pthreads to fetch several files at once
|
||||
* </DESC>
|
||||
*/
|
||||
/* 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
|
||||
* 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
|
||||
* https://github.com/curl/curl/blob/curl-7_88_1/docs/examples/threaded-ssl.c
|
||||
*/
|
||||
|
||||
/* Requires: HAVE_PTHREAD_H */
|
||||
/* Also requires TLS support to run */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -36,15 +46,7 @@
|
|||
|
||||
#define NUMT 4
|
||||
|
||||
/*
|
||||
List of URLs to fetch.
|
||||
|
||||
If you intend to use an SSL-based protocol here you might need to setup TLS
|
||||
library mutex callbacks as described here:
|
||||
|
||||
https://curl.se/libcurl/c/threadsafe.html
|
||||
|
||||
*/
|
||||
/* List of URLs to fetch. */
|
||||
static const char * const urls[NUMT] = {
|
||||
"https://curl.se/",
|
||||
"ftp://example.com/",
|
||||
|
|
@ -59,10 +61,10 @@ struct targ {
|
|||
static void *pull_one_url(void *p)
|
||||
{
|
||||
CURL *curl;
|
||||
struct targ *targ = p;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct targ *targ = p;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, targ->url);
|
||||
(void)curl_easy_perform(curl); /* ignores error */
|
||||
curl_easy_cleanup(curl);
|
||||
|
|
@ -73,8 +75,8 @@ static void *pull_one_url(void *p)
|
|||
|
||||
/*
|
||||
int pthread_create(pthread_t *new_thread_ID,
|
||||
const pthread_attr_t *attr,
|
||||
void * (*start_func)(void *), void *arg);
|
||||
const pthread_attr_t *attr,
|
||||
void * (*start_func)(void *), void *arg);
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue