Win32 programming advice needed for OSProcess port

David T. Lewis lewis at mail.msen.com
Wed Feb 20 15:52:14 UTC 2002


I am in the process of attempting a Win32 implementation of OSProcess.
As a Windows newbie (I just bought a couple of books and downloaded the
development tools from Andreas' site, but I have no experience yet),
I could use some advice on the following:

OSProcess can start external processes, and needs to receive notification
when one of these processes exits. On Unix, I set a signal handler in the
UnixOSProcessPlugin which handles the SIGCHLD ("death of child") signal
from the operating system, and signals a Semaphore in Squeak to indicate
that one of the child processes has exited. This mechanism works fine.

On Windows, there are no "child processes" and no SIGCHLD available
from the operating system. I think that the nearest equivalent mechanism
is to start a Win32 thread which calls WaitForSingleObject() or
WaitForMultipleObjects() to wait for the completion of one or more
external processes. When the call to WaitForSingleObject() returns,
the Squeak Semaphore would be signaled, and cleanup would proceed
similarly to the Unix version.

I can see some potential here for missed signals and general thread
nastiness, so I figure that this is a good time to ask: Am I using the
"right" approach here?  Are there any horrible pitfalls I should know
about (arbitrary limits on number of threads or handles, etc)? Is this
a problem which has been solved before?

Thanks in advance for any advice or pointers.

Dave




More information about the Squeak-dev mailing list