Hi there,
I'm developing my application to access SFTP server with libssh2. And, I
want to give an ability to access the SFTP server from multi-threads to the
application, for example, downloading some files simultaneously.
I have some questions about how to use libssh2_sftp_* functions.
(1) Are "libssh2_sftp_*" functions thread-safe?
(2) If yes, what is a value to issue for each thread? Do I need to issue a
sftp_session value issued by the libssh2_sftp_init() function for each
thread? Or, Can I share the sftp_session value with all threads? That is,
do I need to issue a sftp_handle value issued by the libssh2_sftp_open(dir)
for each thread with the same value of the sftp_session?
(3) If a lock (ex. mutex) is necessary, where I should apply the lock
against my code? From the libssh2_sftp_init() calling to the reading file
with the all libssh2_sftp_read() calling? Or, each API calling?
(4) Is there any sample code to use libssh2 in the multi-threading
environment?
Thank you for your advice.
-- 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-26