[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Windows threads with libssh
[Thread Prev] | [Thread Next]
- Subject: Re: Windows threads with libssh
- From: Alberto Garcia <agarciaillera@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 4 Feb 2019 01:55:22 -0800
- To: Andreas Schneider <asn@xxxxxxxxxxxxxx>
- Cc: libssh@xxxxxxxxxx
What is the equivalent of pthread that can be used in windows? Thank you On Tue, Jan 29, 2019, 12:55 AM Andreas Schneider <asn@xxxxxxxxxxxxxx wrote: > On Tuesday, 29 January 2019 03:21:24 CET Alberto Garcia wrote: > > Hi, > > > > I've read the info at > http://api.libssh.org/master/libssh_tutor_threads.html > > . > > > > I'm writing a program that uses libssh and implements a shell and SOCKS > > capabiliities(SSH_CHANNEL_DIRECT_TCPIP). > > > > When using ssh -D .... it does create one channel for the shell which I > run > > under one thread and one channel per every SOCKS connection which is > > handled in another thread. I'm using std::thread. > > > > Every channel is under the same session and as I said they are handled in > > different threads. If as the link says "You cannot use a single session > (or > > channels for a single session) in several threads at the same time", what > > is the proper way to handled this? > > You can create a thread for one session. All channels derived from that > session need to be handled in the same thread. > > If you want do use multiple threads for channels derived form one session > you > would need a mutex and lock it for each channel access. I guess that will > everything much slower ... > > > Andreas > > -- > Andreas Schneider asn@xxxxxxxxxxxxxx > GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D > > >
Re: Windows threads with libssh | Andreas Schneider <asn@xxxxxxxxxxxxxx> |