[zeromq-dev] Thread Safe sockets
sustrik at 250bpm.com
Mon Feb 6 22:13:48 CET 2012
On 06/02/12 22:08, Gary Wright wrote:
>> What makes the problem bad is the fact that there may be arbitrary
>> interval between sending/receiving 1st and 2nd part of the message.
>> During that time the socket has to be locked which in turn means that
>> all other threads accessing it will be blocked for the period (1 hour,
>> for example).
> You could avoid the indefinitely locking and still have multi-part messages
> by changing the API such that all message parts have to be handed to/from
> the API in one call.
Yes. Standard POSIX gather/scatter arrays.
> At first I thought the multi-part message system would be great for
> streaming chunks of data but each message is buffered within ZMQ
> before being delivered via the API so any sort of streaming
> is going to have to be done via multiple messages anyway. (Someone
> correct me if I'm misunderstanding anything).
Yes. It works that way. That's why I've defined the multi-part messages
earlier on as a simple presentation protocol, a kind of simple XML or JSON.
More information about the zeromq-dev