[zeromq-dev] Thread Safe sockets
john skaller
skaller at users.sourceforge.net
Tue Feb 7 02:56:55 CET 2012
On 07/02/2012, at 12:16 PM, Martin Sustrik wrote:
> 5. That being said, using single socket from multiple threads is not a
> good design decision. It breaks the model of threads viewed as
> stand-alone state machines communicating with the outside world via
> exclusively owned sockets.
Of course it does, because that's NOT the model of threads,
the model you describe is processes.
Threads inherently use locks and shared memory, that's precisely
what distinguishes them from processes.
The issue here is whether 0MQ will support the threading model
as well as the process model.
It already does support threading in the sense it provides a way
to *factor* threads into "thread like behaviour" and "process
like behaviour". What I mean is that a thread can do shared
memory stuff and then use 0MQ as well, so at least some of it
is using the easier to work with message passing model.
--
john skaller
skaller at users.sourceforge.net
More information about the zeromq-dev
mailing list