[zeromq-dev] Thread Safe sockets

john skaller skaller at users.sourceforge.net
Fri Feb 3 23:30:57 CET 2012

On 04/02/2012, at 7:13 AM, Gleb Peregud wrote:

> I have a slightly bad feeling about adding additional overhead to
> zeromq core, which is supposed to be as performant as possible.

The overhead is:

	inline bool thread_safe() const { return thread_safe_flag; }

	if( socket->thread_safe()) // x2

This is a pretty small overhead for an operation that is supposed to
send/receive data over a network. The overhead is a greater %
for set/get socket options.

> In Erlang erlzmq2 bindings it has been solved in the following way:


> Is similar structure possible to implement in Felix?

Possibly, I don't know. Felix doesn't currently need thread safe sockets,
fibres are always scheduled within a pthread. I didn't provide thread safe 
sockets for Felix.

john skaller
skaller at users.sourceforge.net

More information about the zeromq-dev mailing list