[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
callback userdata in multithreaded apps
[Thread Prev] | [Thread Next]
- Subject: callback userdata in multithreaded apps
- From: Eric Bentley <eric@xxxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 12 Oct 2017 14:17:28 -0400
- To: libssh@xxxxxxxxxx
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
Re: callback userdata in multithreaded apps | "eric@xxxxxxxxxxxxxxxx" <eric@xxxxxxxxxxxxxxxx> |