[zeromq-dev] C++ high level binding

Pieter Hintjens ph at imatix.com
Thu Nov 3 14:36:02 CET 2011

On Thu, Nov 3, 2011 at 2:27 PM, Ilja Golshtein <ilejncs at narod.ru> wrote:

> C++ simplifies resource management so maintaining socket lifetime is not as painful as in pure C.

The problem is not C/C++ but that zmq_term requires that you
explicitly set LINGER on any active sockets, and close all sockets,
before calling zmq_term, otherwise applications block forever at

> I am not a big fan of Swiss knife alike tools and don't understand why messaging library should control user threads,
> why GUI library should operate with DB, etc.

There are three reasons:

* to enable portable code, since threading is different on POSIX and Windows
* to properly track socket creation, so shutdown can work safely
* to provide higher-level semantics for threads, e.g. attached
(sharing same context, connected by inproc 'pipe') / detached (using
their own context) threads in CZMQ

Since multithreading is such an important pattern in 0MQ applications,
handling this properly in the language binding makes things much

> Reactors are different.

Also useful, because they simplify many more complex 0MQ patterns.


More information about the zeromq-dev mailing list