Subject: Re: Thread safety issues

Re: Thread safety issues

From: jmk <>
Date: Mon, 30 Aug 2010 17:19:05 -0500

On Mon, 2010-08-30 at 22:53 +0200, Daniel Stenberg wrote:
> On Mon, 30 Aug 2010, jmk wrote:
> > I've added a mutex lock around libssh2_session_init_ex(). This drastically
> > cut down on it blowing up. However, it appears that some of the other
> > functions may also have thread safety issues. Specifically, I had to also
> > lock libssh2_userauth_keyboard_interactive() and libssh2_session_free().
> > With all libssh2_* calls locked, I've been unable to get it to blow up.
> > Certainly not ideal, but better than the alternative for now.
> And are you using the mutex callbacks now for your crypto library of choice?

I wasn't...

I took a look at the threaded-ssl.c example from Curl and implemented
their locking callbacks. With these callbacks and only a mutex for
libssh2_session_init_ex(), everything appears stable now...


Received on 2010-08-31