[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

callback userdata in multithreaded apps


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

Follow-Ups:
Re: callback userdata in multithreaded apps"eric@xxxxxxxxxxxxxxxx" <eric@xxxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org