[zeromq-dev] Thread Safe sockets

Pieter Hintjens ph at imatix.com
Tue Feb 7 13:47:28 CET 2012


On Tue, Feb 7, 2012 at 2:41 AM, Nadav Samet <thesamet at gmail.com> wrote:

> I'm not sure I follow, what's evil about callbacks? In particular, I am
> working on an RPC library on top of ZeroMQ. It spawns n threads, and
> whenever a request arrives it runs a user-supplied function (i.e. callback)
> on one of these threads. Are there alternative designs that I should
> consider?

There's nothing evil about callbacks except when badly implemented,
they create code that is unreadable and hard to improve and thus gets
buggy.

A lot of the more complex examples in the Guide use callbacks, but
it's via a cleanly separated event/callback engine (the zloop reactor)
that produces IMO simpler, easier to modify and reuse code.

-Pieter



More information about the zeromq-dev mailing list