lurking signals in EventSensor

David T. Lewis lewis at mail.msen.com
Fri Jul 4 16:00:16 UTC 2003


On Fri, Jul 04, 2003 at 08:16:50AM -0700, Ned Konz wrote:
> On Friday 04 July 2003 07:53 am, David T. Lewis wrote:
> > As an aside, the Unix VM with an X display could probably be made
> > to do this without resorting to pthreads. All external events are
> > going to originate from one of:
> >  1) external files
> >  2) sockets
> >  3) events originating from the X server (which arrive on a socket
> > channel) 4) OS signals
> >
> > The first three can all be handled by the aio mechanism in Ian's
> > VM, and the forth can be handled in the obvious way. All four can
> > therefore trigger a Squeak Semaphore, and no VM level threads would
> > be required.
> 
> Yes, but for #3 if you wanted to trigger a Squeak Semaphore directly 
> from the X server, you'd have to move X event handling up into 
> Squeak, right? Right now, the aio handler for the X server socket 
> doesn't directly trigger a SqueakSemaphore (at least not until 
> there's some mouse/keyboard/drag event ready).

Yes. Presumably you would want some generalized representation of
external events and queueing of events to the image, with the VM
waking up the image whenever something interesting happens. Not
everything that came in through the X channel would be interesting
to the Squeak image, so the X support in the VM could exercise some
discretion as to what events from the X channel need to be forwarded
to the image.

In principle you would handle all of the X events in the image, with
some plugin to allow the image to control the X display. But I suspect
that would be rather over the top since this is all working fine in
the existing VM already.

I'm getting way out of my depth at this point. I just wanted to
mention that the aio mechanism can be made quite general, and on
some platforms that VM threads would not be necessary if you were
going to support aio anyway. That would allow the timer polling
to be reduced or eliminated with no need for a threaded VM. A
threaded VM might or might not be desirable for other reasons,
but handling of external events not is a reason to require it, at
least not if the platform is already capable of doing aio handling.

Dave

p.s. I finally caught up with the rest of this thread, and I would
not be surprised if the work that Lex mentioned that he did a few
years ago did exactly this kind of thing.

p.p.s. The X protocol itself provides a working example of a cross-platform
representation of queued events, so apparently this is not an impossible
thing to do.



More information about the Squeak-dev mailing list