Morphic polls? (was Re: FFI questions)

Tim Rowledge tim at sumeru.stanford.edu
Sun Jun 18 00:08:21 UTC 2000


Yes, Morphic polls. See HandMorph>processEvents.

Yes, Morphic is event driven - at least as much as it can be right now.

One thing I believe is important is to disentangle events vs. state and
polling vs interrupt driven.

Squeak is currently polling and a mildly odd mixture of event and state
recording. Keyboard evnts are queud in a simple manner, but mouse events
are simply aggregated. If you go:-
red-button, move, $a, $b, $c, move, red-button up, blue-button
and the system polls just before you start and at the end of the
sequence you will appear to have type 'abc' and the blue button down at
the new mouse location. The red button press can get completely missed,
which is probably 90% of what people get cross about.

Most OSs are actually polling as far as the UI programmer is concerned.
You write a loop that looks like
  [true] whileTrue:[eventProcessor handle: self getNextEvent]
in X, W32, Mac, Acorn et al. The lower levels are likely to actually be
interupt driven by hardware events and interupt response routines. If
you have threads and can call your OS getNextEvent analogue within one,
then you can get closer to an event & interupt model.

However, you can also run afoul of another little inconvenience, the
assumption be many UIs that no user input event means nothing to do and
so give no time to the process. This simply isn't always true - consider
when we are generating a new interp.c file.

A good pre-emptive multi-tasking OS with a good interrupt providing and
event recording UI framework would be best. I haven't personally found
one yet, but I hope to one day. The Interval RTOS stuff was an attempt
to make such a thing on bare hardware, but look where that got us...

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- Useful as a football bat.





More information about the Squeak-dev mailing list