Fri, 17 May 2002 18:22:15 -0700
|
"C. Daniel Cooper" wrote asking about the use of the subscribe and
publish approach, which uses callbacks.
Callbacks are generally a mechanism used by sequential languages in
inherently concurrent situations. The most common example is the
inherent concurrency of windowing systems and the C language. Callbacks
complicate software, making it harder to understand and modify
successfully.
With a concurrent language there is no need for callbacks, except for
interfacing to software designed for use by sequential languages.
In this example, the event handler can provide an entry on which tasks
may block, being released when the event occurs. Each "subscriber" can
provide a waiting task that waits on the event, then invokes whatever
action the specific "subscriber" requires. A "subscriber" can
"unsubscribe" by having the waiting task terminate the entry call
prematurely.
--
Jeff Carter
"Monsieur Arthur King, who has the brain of a duck, you know."
Monty Python & the Holy Grail
|
|
|