interpreterProxy signalSemaphoreWithIndex:

David T. Lewis lewis at mail.msen.com
Sat Jun 3 19:34:20 UTC 2006


On Sat, Jun 03, 2006 at 08:32:26PM +0200, Bruno Luca wrote:
> On Sat, 03 Jun 2006 15:27:32 +0200, David T. Lewis <lewis at mail.msen.com>  
> wrote:
> 
> >On Sat, Jun 03, 2006 at 01:06:30PM +0200, Bruno Luca wrote:
> >The #signalSemaphoreWithIndex: method provides a general way to signal
> >a semaphore in the Squeak image from the VM. It works on any platform,
> >including of course Windows. This provides a very nice mechanism for
> >a Process in Squeak "wake up" when some external event happens.
> 
> I didn't try any implementation yet, but i guess i need a threaded loop to  
> check when a Semaphore has been signaled, right?

Yes. For an example, look at InputSensor>>installInterruptWatcher.
This starts a Smalltalk Process (aka thread) that wakes up when you
hit the interrupt key. The VM watches for you to hit the interrupt
key, then calls #signalSemaphoreWithIndex: to activate the interrupt
watcher process. The interrupt watch process just waits quietly in
the background until somebody wakes it up, then it takes over and
tries to interrupt whatever Process was running at the time you
hit the interrupt key.

I assume that you have already loaded VMMaker into your image.
If not, load it from SqueakMap and you'll be able to see all the
code that makes this work. Also, if you open a ProcessBrowser
(from the "Tools" tab) you will see several processes that run
in the background and rely on semaphore signals to wake up and
do their respective jobs.

Dave




More information about the Squeak-dev mailing list