[zeromq-dev] Perennial thread safety question
Niels Berglund
niels.it.berglund at gmail.com
Mon Apr 8 15:02:38 CEST 2013
Hi Pieter,
>For inter-process work, it conceivably makes more sense (at least
>until you understand 0MQ) to consider sharing a socket between
>threads, since one incoming stream may need multiple worker threads.
>However the 0MQ answer is to use one thread as distributor, reading
>from a frontend socket and forwarding to worker threads on a backend
>socket. The Guide has examples of this.
I am having issues understanding how to architect an application correctly
using ZeroMQ (I do have a mail about this from yesterday).
In my scenario, I have a client (using DEALER socket) connecting to a
Server (the server has a ROUTER socket). How would I architect the client,
so I can receive messages on the DEALER socket as well as sending messages.
My problem is that (as far as I understand), I need to have some sort of
loop (poller) to receive messages. By the nature of things, this would most
likely run on a separate thread, yes? Then I want to send messages on the
same socket. Now I assume I will run into issues with multi-threading and
0MQ (at least that's what my tests do). So how would I solve this the 0MQ
way?
Niels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130408/c0534304/attachment.htm>
More information about the zeromq-dev
mailing list