[zeromq-dev] Need to PUB / REQ from multiple threads

Martin Sustrik sustrik at 250bpm.com
Thu Jan 6 09:48:13 CET 2011


Hi Gaspard,

> What prevents the calls from moving between threads, apart from
> thread-safety (as I said, there is a global mutex) ?

Global mutex allows for migrating sockets between application threads 
each time the mutex is locked. So yes, it would work.

> My understanding is that to avoid moving socket calls between threads, I
> would need to push/pull inproc sockets (one PUSH for every thread, one
> PULL for the REQ/PUB sockets) but this seems like a waist of resources...

Well, if you don't care about performance, single process-wide 
bottleneck created by the mutex and inability to scale out of the 
process/box (i.e. ability to change inproc to ipc or tcp in he future) 
there's nothing to prevent you to use the approach.

Martin



More information about the zeromq-dev mailing list