ev_io and message queues

Joachim Nilsson troglobit at gmail.com
Fri Mar 27 20:55:34 CET 2009


My name is Joachim and I'm new to this list. I've just started
evaluating libev as a possible replacement for a homebrew timer
implementation (based on Don Libes "Implementing Software Timers").

So far so good, the timers are easily replaceable.

My next hurdle was refactoring a state machine implemented with System
V message queues, msgget()/msgsnd()/msgrcv(). In particular I tried
connecting an ev_io watcher to the message queue identifier, which is
rumored to be a standard file descriptor in Linux. No luck so far.

So I have two questions:

1) Is this even possible? Can I use any POSIX message queue primitives
with ev_io or should I attempt a redesign using standard file
descriptors or pipes?

2) Does anyone have any other neat idea how to integrate ev_io with
message passing?

If it helps, in my design I have a couple of processes (threads
actually) that generate events from external stimuli (incoming packets
and TIPC messages) and timeouts.  Currently they relay these events
using msgsnd() to a separate process that does msgrcv() and a big
switch-case. The same switch-case can then generate new events to
itself, e.g. start a new timer.

Thanks for a great library!


More information about the libev mailing list