Subject: Re: Usage of errno and thread-safety

Re: Usage of errno and thread-safety

From: Peter Stuge <peter_at_stuge.se>
Date: Mon, 14 Mar 2011 10:34:08 +0100

Hi Sebastien,

Sebastien Fricker wrote:
> Using this variable makes libssh2 not thread safe.

As you may know, the SSH protocol is not really thread safe on the
wire. The lowest level TCP connection (session) can only be used by
one channel at a time. This must of course be respected by programs
using libssh2.

> In fact _libssh2_send()/_libssh2_recv() returns only 3 values:
> 1) >=0: number of bytes transmitted/received
> 2) -EAGAIN: special error which indicates that the read/write
> operation should be re-executed.
> 3) <0 (but not -EAGAIN): real error.
>
> Would it not be possible to use select to generate such error code?
> This would made the _libssh2_send()/_libssh2_recv() thread safe.

I don't understand what the benefit would be? I don't think it would
change anything.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-03-14