sigCHLD signal handling (Was: Re: pipes? threadWaitRead?)

Simon Marlow simonmar at microsoft.com
Thu Jul 11 04:33:14 EDT 2002


> I had thought of having the signal handler reap as many 
> terminated child
> processes as possible, but had been concerned about a possible race
> condition.  After you suggested that approach, I thought some more and
> decided that no race problem should exist.  So I've 
> implemented multiple
> reaping and it does help.  I no longer have any tests hang as before.
> (Note that I still do see the occasional "EVACUATED object entered!"
> error.)  However, the implementation turned out to be 
> surprisingly complex.

Can you manage to get a repeatable case of the 'EVACUATED object' error?
I'd really like to track that one down.

> The first issue I confronted is that the get*ProcessStatus 
> routines return
> an error rather than "nothing" if there is no candidate child process.
> (The GHC routines simply reflect the system call semantics.)

So can't you just catch the error?  Something like

    handler = do
	r <- try (getAnyProcessStatus ...)
      case r of
	  Left  _ -> return ()
	  Right _ -> handler

Cheers,
	Simon




More information about the Glasgow-haskell-bugs mailing list