[zeromq-dev] zmq_reactor on github

Matt Weinstein mattweinstein at gmail.com
Fri Jul 30 21:02:30 CEST 2010


I've submitted a reactor pattern for ØMQ to github at git://github.com/ 

This pattern allow complex arrangements of sockets to be polled in  
arbitrary ways.

The essential way to use this:

	1- Create a bunch of zmq_reactors
	2 - Link them in the right order into list
	2- Tell zmq_reactor_poll to poll them

zmq_reactor_poll() assembles zmq_reactors into poll_items  on the fly,  
and enables and disables flags before each poll, so you can do some  
fun stuff.

The repoll() version is intended to check if anything changed on the  
rest of the list, in case you're pushing packets along between  
connected inproc sockets.

I recommend focusing on:

	zmq_reactor.h -- interface to the zmq_reactor functionality

	queue_device.cpp -- a cute re-implementation of ZMQ_QUEUE using this  

I would like to suggest that the zmq.hpp/zmq::context_t be modified to  
add "operator void*()", so helper functions like zmq_reactor_pair can  
be made useful (see zmq_reactor_pair.h).

The code has only been lightly tested, and feedback is WELCOME, esp.  
as this is my first public release since the 80's 8-)

Kudos to [X+1] for open sourcing the code under the LGPL.




More information about the zeromq-dev mailing list