On Thu, Mar 02, 2006 at 12:33:02AM -0800, John M McIntosh wrote:
ok, after some clues from David I built a mostly broken unix vm, however it was enough to build a OSProcessPlugin as a side effect.
In testing I see that calling primitiveForkSqueakWithoutSigHandler crashes things, I'll suspect forking the carbon vm is a no no.
Hi John,
If you have a chance, could you please try something for me? Change the method UnixOSProcessAccessor>>canForwardExternalSignals to answer false, then save your image and restart.
This will replace the event-driven SIGCHLD handler with a polling loop, and it should work around the problem of SIGCHLD being handled in some pthread other than the interpreter thread.
I think this should prevent the VM crashes you were getting, and it may allow you to run external programs with OSProcess. (But I'll be quite surprised if #forkSqueak works, because I have no clue how or if all those pthreads would be restarted in a child Squeak.)
If the #canForwardExternalSignals workaround helps, we could change it in OSProcess to be:
canForwardExternalSignals "Answer true if it is possible to forward OS signals to a Smalltalk Semaphore." ^ OSProcess isUnixMac not
Dave
p.s. I started reading up on pthreads, and I'm recoiling in horror at the thought. There appears to be no way for the interpreter thread to find the identity of other running threads, hence no straightforward way to set the signal masks such that unix signals can be reliably delivered to the interpreter thread (which needs to do a #signalSemaphoreWithIndex:). I can imagine a workaround, but it in't gonna be pretty.