Subject: Re: LIBSSH2_CHANNEL struct can be shared between the threads in c++??

Re: LIBSSH2_CHANNEL struct can be shared between the threads in c++??

From: Peter Stuge <peter_at_stuge.se>
Date: Mon, 18 Feb 2019 12:16:51 +0000

Richa Mehta wrote:
> I want to share the ssh session and channels structures between the
> threads in c++, so is it thread safe???

Only one thread at a time can use a session. Protect it with a mutex,
and be careful to not release the mutex until the API call is completed
successfully or with error. Ie. do not release the mutex when the
library returns LIBSSH2_ERROR_EAGAIN.

//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2019-02-18