Suppose I establish ssh connection, then create several channels with libssh2_channel_open_session()
- all in one main thread.
Then I create a thread for each channel, and these threads start to write and read from their channels. Each thread uses only its LIBSSH2_CHANNEL*
pointer and never accesses session handle (LIBSSH2_SESSION*
).
Then main thread joins all threads and close the session.
Is this safe? The only thing about thread-safety that I have found in LibSSH2 documentation is "just don't share handles simultaneously". However, I don't understand how this applies to my case. I don't share handles directly, but channel handles are likely to share session handle.