How to implement events on Unix?

Marcel Weiher marcel at metaobject.com
Fri Feb 9 08:49:36 UTC 2001


> From: Stefan Matthias Aust <sma at 3plus4.de>

> >Since almost all VMs currently use a single thread for running both, 
> >interpret() and the event processing loop, we have to be OUT OF
> >INTERPRET() in order to receive an event.
>
> So we should use two threads.  I thought, the event semaphore was  
> introduced for exactly that reason.

The funny thing is that using two threads doesn't really help  
because (a) the image will still poll for events (though more  
cheaply) and (b) the funky delays still happen (in the image) with  
even some droppage.

I think a simpler design would be for Squeak to be truly passive,  
meaning it actually exits the interpreter loop when it is done  
servicing an event.  The external code can then wait for an event and  
resume the interpreter instantly when one happens, without any  
conflicts between responsiveness and idle CPU consumption.

For those applications where a fully-active Squeak is desirable, the  
external code can do a quick check and restart Squeak immediately.   
That way, you still get all of the desired behaviors without all the  
funkyness we have now, and without the requirement for a  
multi-threaded substrate.

Marcel





More information about the Squeak-dev mailing list