Subject: Re: libssh2 thread safety

Re: libssh2 thread safety

From: Peter Stuge <>
Date: Sat, 14 Apr 2012 04:09:09 +0200

Jasmeet Bagga wrote:
> Asked another way, is it safe to use libssh2 from a multi-threaded
> application.

This is the same question, and the answer is also the same: No.

> In our application, ssh sessions are initiated only from a single
> thread, is this ok ?

Initiating sessions is not relevant. All use of libssh2 must be

> Do I need to recompile libssh2 with -D_REENTRANT so that access to
> errno is sane ?

I don't think so. You need to make sure that only one thread calls
libssh2 at a time.

Received on 2012-04-14