[zeromq-dev] A simple C++ wrapper of zmq::poll
Matt Weinstein
matt_weinstein at yahoo.com
Thu Aug 26 23:51:27 CEST 2010
Greetings,
First off, thank you for building your wrapper.
Have you been looking at my poll_items branch? I frankly am a git
newbie and have been so busy I haven't read up on how to squash master
with this branch (or fast forward, or...) I just made it the default.
But I will commit this to master RSN.
On Aug 26, 2010, at 12:30 AM, Radu Braniste wrote:
> Hi Martin,
>
> Compared to Matt’s reactor the wrapper is:
>
> 0: a reactorJ
>
> 1: 100% C++ with different ways of expressing the event handlers
> (not a choice for people looking for plain C)
>
I wrote mine in C figuring it might be compatible with other language
ports, and operates at the same level as the zeromq library.
It's actually relatively easy to wrap this into a class, but the re-
use is in the methods, rather than in attached objects right now.
That can be handled with some forwarding.
> 2: Smaller & internal simpler
>
Yes, I probably should make mine simpler, I originally built chains of
objects, then I moved back to arrays.
> 3: Allows full access at every step of polling - user can
> manipulate directly & dynamically state and/or event handlers (add/
> remove/change)
>
I found this doesn't happen often enough in a real-world scenario to
require it from poll to poll, and the data structure was too balky. I
simplified it by allowing any reactor to cause the poll to return with
a status code of its choosing, and the wrapper around it can then call
with an updated poll vector (literally I'm using stl::vector).
> 4: Doesn’t offer any predefined “operations” that might make life
> easier for the user in some scenarios – but they can be easily
> cooked and reused
>
>
I tried for a simple "microcode" after having built complex policies.
Probably the next approach should be a policy that operates on some
additional data in the vector, and let it make the switching
decisions. The current "policy" would then just snap on, as e.g.
zmq_reactor_poll_policy(.... microcode_policy).
>
> PS: I’ve just added to the documentation a short how-to note about
> adding/removing dynamically event handlers as well as an example
> describing this feature (server3.cpp)
>
>
Yeah IOU a lot of app notes. :-)
> Radu
>
> ______________________
Best,
Matt
> _________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100826/05fcead3/attachment.htm>
More information about the zeromq-dev
mailing list