www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

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

Re: Using libssh2_sftp_* functions in multi-threading environment

From: Peter Stuge <peter_at_stuge.se>
Date: Mon, 26 Jan 2015 16:52:59 +0100

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
Received on 2015-01-26

the libssh2 team