Blame doc/threading.dox

Packit Service 31306d
/**
Packit Service 31306d
@page libssh_tutor_threads Chapter 8: Threads with libssh
Packit Service 31306d
@section threads_with_libssh How to use libssh with threads
Packit Service 31306d
Packit Service 31306d
libssh may be used in multithreaded applications, but under several conditions :
Packit Service 31306d
 - Your system must support libpthread or, in Windows environment,
Packit Service 31306d
   CriticalSection based mutex control.
Packit Service 31306d
 - Since version 0.8.0, threads initialization is called automatically in the
Packit Service 31306d
   library constructor if libssh is dynamically linked. This means it is no
Packit Service 31306d
   longer necessary to call ssh_init()/ssh_finalize().
Packit Service 31306d
 - If libssh is statically linked, threading must be initialized by calling
Packit Service 31306d
   ssh_init() before using any of libssh provided functions. This initialization
Packit Service 31306d
   must be done outside of any threading context. Don't forget to call
Packit Service 31306d
   ssh_finalize() to avoid memory leak
Packit Service 31306d
 - At all times, you may use different sessions inside threads, make parallel
Packit Service 31306d
   connections, read/write on different sessions and so on. You *cannot* use a
Packit Service 31306d
   single session (or channels for a single session) in several threads at the same
Packit Service 31306d
   time. This will most likely lead to internal state corruption. This limitation is
Packit Service 31306d
   being worked out and will maybe disappear later.
Packit Service 31306d
Packit Service 31306d
@subsection threads_init Initialization of threads
Packit Service 31306d
Packit Service 31306d
Since version 0.8.0, it is no longer necessary to call ssh_init()/ssh_finalize()
Packit Service 31306d
if libssh is dynamically linked.
Packit Service 31306d
Packit Service 31306d
If libssh is statically linked, call ssh_init() before using any of libssh
Packit Service 31306d
provided functions.
Packit Service 31306d
Packit Service 31306d
@subsection threads_pthread Using libpthread with libssh
Packit Service 31306d
Packit Service 31306d
Since version 0.8.0, libpthread is the default threads library used by libssh.
Packit Service 31306d
Packit Service 31306d
To use libpthread, simply link it to you application.
Packit Service 31306d
Packit Service 31306d
If you are using libssh statically linked, don't forget to call ssh_init()
Packit Service 31306d
before using any of libssh provided functions (and ssh_finalize() in  the end).
Packit Service 31306d
Packit Service 31306d
@subsection threads_other Using another threading library
Packit Service 31306d
Packit Service 31306d
Since version 0.8.0, libssh does not support custom threading libraries.
Packit Service 31306d
The change makes sense since the newer versions for libcrypto (OpenSSL) and
Packit Service 31306d
libgcrypt don't support custom threading libraries.
Packit Service 31306d
Packit Service 31306d
The default used threading library is libpthread.
Packit Service 31306d
Alternatively, in Windows environment, CriticalSection based mutex control can
Packit Service 31306d
be used.
Packit Service 31306d
Packit Service 31306d
If your system does not support libpthread nor CriticalSection based mutex
Packit Service 31306d
control, unfortunately, you cannot use libssh in multithreaded scenarios.
Packit Service 31306d
Packit Service 31306d
Good luck !
Packit Service 31306d
*/