[zeromq-dev] changing the C++ api to not throw exceptions on EFSM

Yi Ding yi.s.ding at gmail.com
Wed Jan 25 20:14:37 CET 2012


The C++ API is currently written in such a way that any return value on
zmq_recv, except for EAGAIN, triggers an exception.

However, if we use REQ/REP in conjunction with ZMQ_FD, as we currently do
in our code and nzmqt (I'm sure it's also used in other bindings) EFSM is
basically unavoidable as triggering a EFSM is required if we want to
"reset" the receive state for the edge-triggering.

There are a couple of ways I can think of dealing with this (from least to
most radical):
1) try catches every time we call recv.  This is how we do this currently,
but having exceptions that aren't exceptional doesn't seem to be
particularly good programming practice.
2) don't throw an exception on EFSM in the C++ binding, and instead return
false
3) if ZMQ_NOBLOCK is passed in, replace EFSM with EAGAIN.
4) Get rid of REQ-REP entirely, and just subsume it with ROUTER-DEALER

Cheers,
Yi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120125/96fa3dfd/attachment.htm>


More information about the zeromq-dev mailing list