Native Windows VM extension

David T. Lewis lewis at mail.msen.com
Fri Mar 22 11:30:28 UTC 2002


On Fri, Mar 22, 2002 at 11:33:50AM +0100, goran.hultgren at bluefish.se wrote:
> 
> I was more thinking in terms of "missing pieces" - for example, not
> having callbacks sounds like a biggie. Or perhaps it's not? And perhaps
> Python has an edge in regard to how GC works etc. Well, as you see I
> don't really know - that's why I am asking! :-)
> 
> I assume that there are examples in the available plugins how to
> "emulate" callbacks using Semaphores etc. Hmmm, I guess I will just have
> to dive in and see how it goes...

This seems to be a perfectly good mechanism for certain kinds of of
"callbacks." You cannot easily pass information about a callback event
this way, but if you know what kind of event you are waiting for, it
works fine. There are two examples you can browse in the OSProcess code.

In UnixOSProcessPlugin, the #setSigChldHandler and #reapChildProcess:
are the VM side of the mechanism. They establish a signal handler
which signals a Semaphore in the image when a certain type of signal
is received from the Unix operating system. On the Squeak side,
an instance of UnixOSProcessAccessor sets up the signal handler
(#sigChldSemaphoreSet) and waits on the Semaphore (#grimReaperProcess).

There is a similar mechanism for Windows in Win32OSProcessPlugin and
WindowsOSProcessAccessor. The methods are in the "child process
management" categories for these two classes. They work similarly to
the Unix ones, except that on Windows we set up a thread to wait for
the external event rather than using an operating system signal.

Dave




More information about the Squeak-dev mailing list