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

Pieter Hintjens ph at imatix.com
Tue May 19 17:49:17 CEST 2015


Please read the Guide and study the examples, that is the best way to
learn how to use the technology.

On Tue, May 19, 2015 at 3:23 PM, 黄颖志 <nohuangyz at gmail.com> wrote:
> Ok, lastly i am reading zeromq resource code. ZeroMQ, as the fastest mq, i
> need to learn the design philosophy of it. Is there any documents argument
> with its architecture?
>
>
> 2015-05-19 20:29 GMT+08:00 Charles Remes <lists at chuckremes.com>:
>>
>> Both of those techniques are the recommended ways to use zeromq sockets in
>> a multi-threaded application. I’m sorry that you don’t like those
>> techniques, but they work very well.
>>
>> The zmq_poll function is *not* thread-safe, so be very careful with it.
>>
>>
>> On May 18, 2015, at 23:46, 黄颖志 <nohuangyz at gmail.com> wrote:
>>
>> 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
>>>
>>
>> _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list