Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Matt Weinstein <mattweinstein <at> gmail.com>
Subject: zmq_reactor on github
Newsgroups: gmane.network.zeromq.devel
Date: Friday 30th July 2010 19:02:30 UTC (over 6 years ago)
Folks,

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

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  
model

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.
---

Enjoy,

Best,

Matt
 
CD: 3ms