cURL / Mailing Lists / curl-library / Single Mail

curl-library

Question about multi-threading locking requirements

From: David Lobron <dlobron_at_akamai.com>
Date: Thu, 3 May 2007 12:18:41 -0400

Hi All,

I am developing an application that will download up to a few hundred
files at a time over HTTPS. The download part of my application is
synchronous and single-threaded, i.e., the program downloads one file
at a time and does not create any separate download threads. I am
using OpenSSL in a C program that uses libcurl.

My program has two other threads besides the main thread: a log
thread and a cache-cleaning thread. These threads perform only
location operations, and do not use any SSL functions. My question is
whether I need to include the OpenSSL thread-locking functions in my
code, as recommended in the libcurl documentation, if I only have a
single thread that actually uses OpenSSL. Is it possible for my log
and cache-cleaning threads, which do not use OpenSSL, to somehow
affect its data structures if they are scheduled while I have a
libcurl download session running?

The OpenSSL functions I'm referring to are the ones specified here:

http://www.openssl.org/docs/crypto/threads.html

If I do need the lock functions, I will probably copy the code here:

http://curl.haxx.se/lxr/source/docs/examples/opensslthreadlock.c

I'd prefer not to do the lock functions if they're not needed, of
course.

Thanks in advance, and apologies if this is an obvious newbie
question- this is my first time hacking with libcurl.

Thank you again,

David
Received on 2007-05-03