On 12 February 2014 18:09, Peter Stuge <pe...@stuge.se> wrote: > xingzhiming wrote: >> How to use multi-thread calls libssh2? > > Protect all calls which use the same session with a mutex.
At a quick glance, the OP's code doesn't share sessions between threads, so it's more likely an issue with multiple threads calling the crypto backend. In particular libssh2_init is not thread safe, but the OP calls this in the worker thread. Instead they should call it once for the entire program before spawning any worker threads. Alex -- Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org) _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel