cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threads & OpenSSL - Mutex what? Examples?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 27 Feb 2009 07:55:38 +0100 (CET)

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
Received on 2009-02-27