Subject: Re: Using libssh2_sftp_* functions in multi-threading environment

Re: Using libssh2_sftp_* functions in multi-threading environment

From: Yoichiro Tanaka <yoichiro_at_eisbahn.jp>
Date: Tue, 27 Jan 2015 20:08:48 +0900

Thanks, Peter. I could understand.
I intend to create sessions against each thread, and handshake for each
them.

-Yoichiro

2015-01-27 0:52 GMT+09:00 Peter Stuge <peter_at_stuge.se>:

> Yoichiro Tanaka wrote:
> > (1) Are "libssh2_sftp_*" functions thread-safe?
>
> No.
>
> > (3) If a lock (ex. mutex) is necessary, where I should apply the lock
> > against my code?
>
> To be really safe, around any atomic operation relating to a
> libssh2_session. Very coarse locking.
>
> If you want, you can investigate if perhaps multiple SFTP channels
> will work correctly, but I doubt it, because the session IO is not
> thread-capable.
>
>
> > (4) Is there any sample code to use libssh2 in the multi-threading
> > environment?
>
> Unfortunately not.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

-- 
Yoichiro Tanaka
Email: yoichiro_at_eisbahn.jp
Blog: http://www.eisbahn.jp/yoichiro

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-01-27