[zeromq-dev] Should I replace mutex using ZMQ?
Fucong.Luo
bayinamine at gmail.com
Tue Apr 15 06:23:39 CEST 2014
Why do you thought it's not best solution that create the thread D? I think it is the right way of using zeromq(nothing but a message dealer). And I also believe that is some design pattern call "Actor Model".
Sincerely Fucong.Luo
> 在 2014年4月15日,11:23,Dong Mo <montedong at gmail.com> 写道:
>
> Dear list,
>
> I am very new to zmq and noticed in http://zguide.zeromq.org/page:all#Multithreading-with-MQ that it seems to be a good idea to replace mutex with message passing in zmq.
>
> But my question is that how should I exactly transform from the notion of mutex, conditional variable and etc to the thinking pattern of zmq.
>
> Here is an example I encountered:
>
> I have thread A, B, C. They will all modify state S. In the past, I will do lock on this shared state and they can coordinate, but I don't know how to express the mutex semantic using zmq. One way I think of is that I create another thread D and let A,B,C communicate with D over zmq when they want to manipulate S, and there will be no race condition since D is coordinating everything. But I feel that this is definitely not the best practice...
>
> So could you inform me what is it and why it is worthwhile to use zmq instead of mutex
>
> Sorry if this question is naiive, still trying to figure things out.
>
> Thank you very much
> -Mo
> _______________________________________________
> 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/20140415/a3a04ea7/attachment.htm>
More information about the zeromq-dev
mailing list