Subject: Re: libssh2 thread safety

Re: libssh2 thread safety

From: Jasmeet Bagga <jasmeet_at_packetdesign.com>
Date: Fri, 13 Apr 2012 19:27:17 -0700

On 4/13/12 7:09 PM, Peter Stuge wrote:
> 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
> synchronized.
s/initiated/contained/ i.e. all sessions are contained within a thread.
The other thread does not do anything with libssh2.
>
>> 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.
Only one thread does. However I am getting login failures with error
message "Failed getting banner". Looking at another mail thread
(http://www.libssh2.org/mail/libssh2-devel-archive-2010-06/0243.shtml)
it seems the problem went away after compiling with -D_REENTRANT. I
tried this but it didn't help. Unfortunately I can't access the
associated ticket as libssh2 trac is down.

Jasmeet
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-04-14