Subject: Re: Thread safety issues

Re: Thread safety issues

From: Daniel Stenberg <>
Date: Mon, 30 Aug 2010 15:51:44 +0200 (CEST)

On Mon, 30 Aug 2010, Jose Baars wrote:

> Wouldn't the libssh2_init function be one of the prime suspects? This
> function was added in libssh2 1.2.7.

Quoted from the man page for libssh2_init():

        It uses a global state, and is not thread safe -- you must
        make sure this function is not called concurrently.

... and before anyone questions the reasoning for this let me exaplain that
the underlying libraries (OpenSSL or libgcrypt) both have non thread-safe init
functions themselves that libssh2 need to use.

Thus, 1.2.7 is actually more thread-safe than previously as now it offers a
way for the app to do these things in a controlled manner.

Received on 2010-08-30