[Haskell-cafe] Mixing C++ and Haskell, OpenSSL thread safety, and using mmap

Branimir Maksimovic bmaxa at hotmail.com
Thu Dec 8 04:28:08 EST 2005

>From: Joel Reymont <joelr1 at gmail.com>
>To: "Branimir Maksimovic" <bmaxa at hotmail.com>
>CC: haskell-cafe at haskell.org
>Subject: Re: [Haskell-cafe] Mixing C++ and Haskell, OpenSSL thread safety, 
>and using mmap
>Date: Thu, 8 Dec 2005 09:21:08 +0000
>I use OpenSSL in a heavily threaded environment. It works without  extra 
>locking. I do not use bound (OS) threads, though.

If code executes concurrently that means you have a problem with OpenSSL
for sure. Probably it works now because SSL calls are not concurrent
or so, but I wouldn't risk about it as I am sure that you would have
problems with that if calls to SSL functions are concurrent.
Also, I think that original problem of gethostbyname just hides real
SSL problem as you've probably locked around that too, but you can't
be really sure. so either lock around every SSL call with global mutex
or set locks in C module then call Haskell or setup callbacks from Haskell,
whichever way you prefer.

Greetings, Bane.

>On Dec 8, 2005, at 7:06 AM, Branimir Maksimovic wrote:
>>First I want to say about OpenSSL thread safety. It is not thread  safe by 
>>Who wants to import and use OpenSLL functions with FFI, have to set  
>>locking hooks for it,
>>or else spurious  crashes with useless stack trace will result.  Higher 
>>level of concurrency,
>>more likely crash will happen.

Express yourself instantly with MSN Messenger! Download today it's FREE! 

More information about the Haskell-Cafe mailing list