mac VM 3.2.5b7

John M McIntosh johnmci at smalltalkconsulting.com
Wed Mar 6 23:39:49 UTC 2002


>On Wednesday, March 6, 2002, at 10:40 PM, John M McIntosh wrote:
>
>>I've not sure what you mean by making it passive?
>
>Making the outside world call Squeak, instead of the other way 
>around, with Squeak returning once it is done processing the current 
>event.  
>(Yes, there is the issue of background Squeak threads, but there is 
>a solution:  when returning, Squeak should indicate how soon it 
>would like to be run again).

Mmm the original browser plugin code did this. it run interp.c for 
awhile (a meaningful number of milliseconds), then exit back to the 
caller. One of the issues with your thought is how do you know the 
time period when there isn't anything for squeak to do? Many morphs 
are sleeping waiting to be woken up to run step functions and the 
like. Kinda back to the comments earlier last month about using OS 
timers to wake things up.

>
>>Right now the main thread blocks on RunApplicationEventLoop.
>>The pthreaded inter.c spins, and perhaps does a usleep() (which is 
>>a pthread delay).
>
>I thought it was a Mach thread_switch() with the option wait.

Yes, sorry, I kinda simplified what is happening

usleep.c as part of Darwin/Libc-167/gen.subproj/CVS

void
usleep(useconds)
         unsigned int useconds;
{
     (void)syscall_thread_switch(THREAD_NULL, SWITCH_OPTION_WAIT, 
useconds / 1000);
}


>CocoaSqueak does.  It has implemented the two-thread, event-driven 
>model for well over a year now.  However, it would be even nicer if 
>you didn't need two threads to live in an event driven environment.
>

Well if the carbon event stuff was done right,  I should be able to 
setup those carbon event entry points, say go for it and continue 
running the application, versus having to invoke 
RunApplicationEventLoop then have this issue come up. Mind this issue 
ensures you don't have race conditions because technically your app 
is single thread right  until the point you want to actually do 
background work not based on events firing.


Note the EventSensor will fire every 500 ms. That should be changed 
to wait many seconds/forever?. Say we propose a VM attribute that 
indicates true event signalling then we could alter EventSensor...




-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list