--- Tobias DiPasquale <anany / ece.villanova.edu> wrote:
> Why do you say that not every API has access to
> event-based programming?
> What language (aside from Microshaft POS languages) do
> you know of that
> doesn't implement select()? 

select() isn't an event-handling framework though; it's one
building-block in an event-handling framework.  Before you
can say 'register_handler(my_handler)' you have to
implement something like the Reactor pattern, where an
object takes care of mapping registered handlers to
assorted events, and sets up the call to select().  So
before the programmer can start programming in an
event-driven manner, he must first create the framework in
which to do so, or use someone else's framework.  All I'm
saying is that most API's don't include a convenient
event-registering framework like Ousterhout talks about.

And it may not be as simple as calling select(), either. 
For example, supposing in addition to dispatching pending
on timeouts and I/O events, you also need an event handler
called back whenever a certain file changes.  And supposing
that's not one of the things that select() can pend on, and
the OS doesn't support any kind of "call me back when this
file changes" syscall?  Well, now you've got to extend your
event handling framework to respond to generic signals, and
set up a seperate thread to periodically poll the file and
signal the event demultiplexer whenever it changes.

Point being, event-based programming is great; but with
most APIs there's a lot of framework-building that has to
happen before you can even begin to register event
handlers.

- Avdi Grimm

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/