[zeromq-dev] how to use ZeroMQ socket in multithread

黄颖志 nohuangyz at gmail.com
Tue May 19 06:46:51 CEST 2015


Yeah, the zguide says if in multithread , i should create a inporc socket
per thread. but i don't want to create too much socket. Another method is
to make sure each thread executes a full memory barrier before accessing
the socket, in my opinion that is a hard work.

2015-05-15 21:21 GMT+08:00 Charles Remes <lists at chuckremes.com>:

> The FAQ available here http://zeromq.org/area:faq explains how to use
> zeromq in a multi-threaded environment.
>
> The zguide also has good information on this topic.
>
> cr
>
> On May 15, 2015, at 08:18, 张凯 <zhangkai.gis at 163.com> wrote:
>
> It seems zeromq can not used in multithread.But you can adjust your code
> with zmq_poll.
>
> At 2015-05-14 20:50:23, "黄颖志" <nohuangyz at gmail.com> wrote:
>
> Hi every body,
>   Lastly, my J2EE project use ZeroMQ as a message system , In that
> project,  I want to encapsulate ZeroMQ socket as a high level API, so
> others could use that socket send messages if thay want . But the guide
> document says that ZeroMQ sockets are not thread safe.  How can I solve
> that problem. I don't want to create a new socket when sending some message
> through ZeroMQ every time.
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150519/b27451e6/attachment.htm>


More information about the zeromq-dev mailing list