[linux-audio-dev] A "best" event delegation strategy?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] A "best" event delegation strategy?
From: Lukas Degener (AFBLukas_AT_gmx.de)
Date: Fri May 30 2003 - 14:39:25 EEST


Hi list,
Here is a propblem that is propably already solved in another context,
so i would like to know some opinions on it:

I am trying to implement a (hopefully:-) ) simple general-purpose event
delegation architecture.
The actual application will propably be something like a network of
modules that can do arbitrary filtering, generation and manipulation of
midi events in real time.

As propably different kinds of external event sources, like several midi
ports, maybe joystick device and of course a gui, are involved, how
would one efficiently organize the delegation of events passed between
the modules, so that the everything is still thread-safe?

The three main ideas i can currently think of are:

A: don't do it at all, that is, everything is implemented as simple
subject/observer patterns, so that the communication is a pure
module-to-module thing.
    Mutexes et al, would have to be managed by each individual plugin.

B: use a global, mutexed event queue. This could be a priority queue for
time-stamped events, or a simple FIFO.

C: use local queues. As above, but for each individual module.

Each of the above aproaches seems to have its advantages and
disatvantages. E.g. if queues are used, this would as far as i an judge,
make it easy to have feedback cycles.
OTOH this would propably introduce some overhead which aproach A
wouldn't have. C would propably involve a single thread for each module,
or a global "clock" thread that periodicaly calls an "process_queue"
method on each module.

Is there a general "best" way to do this?

Kind regards,
Lukas


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri May 30 2003 - 14:45:47 EEST