exec/3 and waiting for processes...

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Sun 17 Nov 2002 01:16:23 AM GMT
Message-Id: <1037495784.15944.160.camel@ssardina.com.ar>
Hello, I have a problem with spaning unix processes from ECLIPSE and
recovering its resources later:

As the doc says, it's recomendend to do a wait/2 for each exec/3 because
otherwise the process is finished but still "there".
wait/2 in fact does that, waits until the process is finished and frees
its resources after that.

Now as the doc points out, if a signal arrives while "waiting" an error
occurrs (from wait/2 doc):

Error:
      [eclipse]: exec(bc, [], A), wait(P, S).
      Signal 23            % sending a signal to this process
      system interface error: Interrupted system call
                                          in wait(_g50, _g42)
      [eclipse]:


the problem is that my application may receive a io signal at any point
that I handle with an interrupt handler and an even hanlder. If I'm very
lucky and the interrupts arrives when I'm in the process of waiting for
some process that I ran with exec/3, then my program aborts!!

Anybody knows how to handle this? either I need to avoid wait/2 to give
me an error if an interrupt arrives or I need to issue a wait/2 only
after I know the process is totally finished (since waiting 1 second can
be too much and an interrupt may arrive!). I couldn't find anything to
"learn" whether a unix process is finished.

is there any wait of avoiding the above error with wait/2 ?

Thanks!

Sebastian
Received on Sun Nov 17 02:08:39 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:18 PM GMT GMT