Please add a flag LIBSSH2_INIT_MULTITHREADED to libssh2_init(int flags). Openssl and gnutls need to be initialized in a special way in order to be thread safe. It's quite easy, but as far as I can see libssh2 does not support a thread sa...