Re: libssh multi-threading issue
- Subject: Re: libssh multi-threading issue
- From: Mike Jones <mrjones@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 16 Apr 2014 04:53:17 -0500
- To: libssh@xxxxxxxxxx
On 4/16/2014 1:51 AM, ZhangAnne wrote:
> I am implementing a shared library, and met the threading issue when
> the program calls my library and executes multiple threads in
> parallel. Since my lib is being called by other program, I cannot
> initialize the threading outside of any threading context as mentioned
> here: http://api.libssh.org/master/libssh_tutor_threads.html
> My control to the code is limited within the scope of my library. I am
> wondering if there is any workaround other than changing code ouside
> my library?
If it helps, I used libssh in a multi-threaded application without
calling ssh_threads_set_callbacks() or linking libssh_threads.
In fact, I never even read this part of the libssh documentation before
The main/original thread of the application calls ssh_init() and then
spawns off one additional thread that makes all the other libssh calls.
The freeing of resources and ssh_finalize() are done back in the
original thread after this other thread has finished.
So far there have been no issues that I can attribute to using it this way.
We're running on Linux (RedHat 6.x) and using libpthread.
Archive administrator: email@example.com