cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threads & OpenSSL - Mutex what? Examples?

From: John D <cononet_at_gmail.com>
Date: Sat, 28 Feb 2009 02:01:26 +0200

I got it working great in c++ Thanks On Sat, Feb 28, 2009 at 1:50 AM, Toby
Peterson

<
toby_at_apple.com> wrote:

> On Feb 27, 2009, at 1:57 PM, John D wrote:
>
>> On Fri, Feb 27, 2009 at 8:55 AM, Daniel Stenberg <daniel_at_haxx.se> 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:
>>>
>>> http://curl.haxx.se/lxr/source/docs/examples/threaded-ssl.c
>>>
>>> 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.
>>>
>>> --
>>>
>>> / daniel.haxx.se
>>>
>> 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.
>>
>> Regards,
>>
>> John
>>
>>
> It compiles fine as C, and it's a very simple error to fix if you need it
> for C++
>
> - Toby
Received on 2009-02-28