Win32 programming advice needed for OSProcess port

David T. Lewis lewis at mail.msen.com
Sat Feb 23 16:58:46 UTC 2002


On Wed, Feb 20, 2002 at 10:52:14AM -0500, David T. Lewis wrote:

Thanks to Mark Schwenk, David Chase and Craig Latta for helpful
suggestions on my question about how to get Win32 to notify Squeak
when an external Win32 process exits.

This is probably not of general interest, but for what it's worth
here is the design I ended up implementing (after a few false starts).
It seems to be working fine so far. From the class comment of
WindowsProcess:

When external processes are created, they are added to my allMyChildren
collection, and a thread is created to wait for any of them to exit
using a call to WaitForMultipleObjects() function. This thread is held
by my childWatcherThread instance variable while the thread is active,
and is also added to my threads collection.

Whenever a child process exits, the childWatcherThread will signal a
Semaphore (a Smalltalk Semaphore, not a Windows semaphore), then
exit. A Squeak process in my processAccessor waits on this Semaphore,
and sends an 'update: #childProcessStatus' message to me. In response
to this, I update the status of my active child processes, one or more of
which will have exited. If any of my child processes are still active,
I set a new childWatcherThread to wait for them to exit.

Dave




More information about the Squeak-dev mailing list