[Ace-users] [ace-users] Basic Reactor concepts

Gonzalo Diethelm gonzalo.diethelm at diethelm.org
Wed Feb 20 12:51:36 CST 2008


ACE 5.4.7 on Ubuntu linux 2.6.22 (7.10)

Again, I am trying to lessen my ignorance here...

Although I have always seen the Reactor as a key piece in the Acceptor /
Connector / Svc_Handler class family in ACE, used to process I/O, a
Reactor seems to be a generic concept for solving the following
requirement, right?

"Decouple the reception of events from its processing, in a way that,
for instance, makes it possible to receive events in one thread and
process them in a different thread".

Now, for me to understand this better, let me pose an example to you and
maybe someone can indicate, if I am correct, how such an example would
be handled with a Reactor. Say I have N message queues; they are all
filled via some kind of opaque process which does not concern us, except
for the fact that each queue is filled totally independent from the
others (for example, one queue could store mouse events, another could
store serial port incoming data, etc.). Now, I wish to have M threads
(M != N) running in parallel, with an identical, simple infinite loop
that will fetch an event from a queue that has signalled it has events
available, and then process this event.

If I am right in my assumptions about the Reactor's purpose in life, how
do I wire things in this scenario in order to have the N queues use a
Reactor to notify the M threads for processing?

I hope someone can enlighten me or, if I got this wrong, point me in the
right direction. Thanks in advance and best regards,

-- 
Gonzalo Diethelm
gonzalo.diethelm at diethelm.org



More information about the Ace-users mailing list