libssh 0.5.4
|
libssh may be used in multithreaded applications, but under several conditions :
To initialize threading, you must first select the threading model you want to use, using ssh_threads_set_callbacks(), then call ssh_init().
#include <libssh/callbacks.h> ... ssh_threads_set_callbacks(ssh_threads_get_noop()); ssh_init();
ssh_threads_noop is the threading structure that does nothing. It's the threading callbacks being used by default when you're not using threading.
If your application is using libpthread, you may simply use the libpthread threading backend:
#include <libssh/callbacks.h> ... ssh_threads_set_callbacks(ssh_threads_get_pthread()); ssh_init();
However, you must be sure to link with the library ssh_threads. If you're using gcc, you must use the commandline
gcc -o output input.c -lssh -lssh_threads
You must find your way in the ssh_threads_callbacks_struct structure. You must implement the following methods :
Good luck !