cURL / Mailing Lists / curl-library / Single Mail


Re: Threads & OpenSSL - Mutex what? Examples?

From: John D <>
Date: Fri, 27 Feb 2009 23:57:20 +0200

On Fri, Feb 27, 2009 at 8:55 AM, Daniel Stenberg <> wrote:

> On Thu, 26 Feb 2009, John D wrote:
> As far as your advice though. I am a little unclear on some things if you
>> don't mind.
>> Particularly if thread_setup <ident?i=thread_setup>(void) is being called
>> only once before all the treads are made or called from within each created
>> thread. Same question goes for the destroy I guess.
>> More so I am still unclear on void
>> locking_function<ident?i=locking_function>in particular. I don't grasp if
>> you call this directly and if so where? it is used to mutex a segment of my
>> own code or automatic calls of the openssl lib.
> Then take a look at the somewhat more functional example as I believe it
> answers those questions:
> The setup and destroy are done before any threads are started. The locking
> function is what OpenSSL uses, it calls that function to get a mutex
> functionality. I don't know the inner workings of OpenSSL so I can't comment
> on any such.
> --
> /

Somewhat being the key word,

test.cpp: In function ‚void init_locks()‚:
test.cpp:62: error: invalid conversion from ‚void (*)()‚ to ‚void (*)(int,
int, const char*, int)‚
test.cpp:62: error: initializing argument 1 of ‚void
CRYPTO_set_locking_callback(void (*)(int, int, const char*, int))‚

It doesn't compile. While I understand openssl being thread safe or not is
not in anyway your fault,
a lack of a thoroughly documented easy to follow way to make its use in
libcurl so, most certainly is.


Received on 2009-02-27