How to implement events on Unix?

Marcel Weiher marcel at metaobject.com
Sat Feb 10 16:28:29 UTC 2001


> From: "Lex Spoon" <lex at cc.gatech.edu>

> > 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.
> >
>
> I think it actually works this way already.  If every thread becomes 
> inactive, then the idle thread will wake up and yield to the OS.

Yes, it works as you describe it.  However, that is not what I described.

What I described is returning from a method, not sleeping in a  
method to give other threads/processes a chance to run.  I think it  
should be obvious that these two behave very differently.

> The "yield" call is required to return control if any event has  
occured.

Yes.  However, since you are deep inside a call-sequence, you can  
only actively check for events.  You cannot passively just sit there  
and wait for the OS to call you.

Marcel





More information about the Squeak-dev mailing list