[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: callback userdata in multithreaded apps
[Thread Prev] | [Thread Next]
- Subject: Re: callback userdata in multithreaded apps
- From: "eric@xxxxxxxxxxxxxxxx" <eric@xxxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 12 Oct 2017 15:18:10 -0400
- To: libssh@xxxxxxxxxx
i solved the issue by using a mutex. Set before bind accept and release after auth success/fail. Perhaps not the most efficient but its gets me moving again. -Eric > On Oct 12, 2017, at 2:17 PM, Eric Bentley <eric@xxxxxxxxxxxxxxxx> wrote: > > I’m looking at the examples/samplesshd-cb.c (https://git.libssh.org/projects/libssh.git/tree/examples/samplesshd-cb.c <https://git.libssh.org/projects/libssh.git/tree/examples/samplesshd-cb.c>) example and am trying to use it as a model for a multithread version that would be able to accept multiple simultaneous connections. > > The problem is that the callback userdata member is shared amongst all threads. I don’t want to have to reinvent the wheel here so is there an existing way to deal with this in multithread solutions? > > If not, I’m thinking of either passing in a userdata struct which includes a mutex, or adding something to the session structure. > > Thanks in advance. > > -Eric
callback userdata in multithreaded apps | Eric Bentley <eric@xxxxxxxxxxxxxxxx> |