Thanks Peter, I have one another query: Currently I have implemented the design as follow:
Main thread is opening the Netconf session and channel, After session and channel is opened, it is handed over to request thread, it will write the data on that channel in nonblock fashion, after write is complete, Response thread will be triggered to read the data on Channel in non block fashion. So in above design as at a time only thread is accessing the channel do I require mutex to protect the session and channel?? And Thread that has openend the session, that thread should only close the session??? Thanks, Richa On Mon, 18 Feb 2019 at 17:48, Peter Stuge <pe...@stuge.se> wrote: > 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 >
_______________________________________________ libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel