[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [dev-serveez] gh_leave ?
From: |
Martin Grabmueller |
Subject: |
Re: [dev-serveez] gh_leave ? |
Date: |
Tue, 13 Mar 2001 12:17:49 +0100 (MET) |
> From: stefan <address@hidden>
> Date: Tue, 13 Mar 2001 09:28:22 +0100 (CET)
>
> On Tue, 13 Mar 2001, Martin Grabmueller wrote:
>
> > > From: "Raimund 'Raimi' Jacob" <address@hidden>
> > > Date: Mon, 12 Mar 2001 18:28:10 +0100 (CET)
> > >
> > > when using guile from serveez i have to gh_enter() so guile takes over
> > > control. i dont know if that's cool when we fork() and exec() and
> > > stuff. can i gh_leave() somehow so that guile disappears completely ?
> >
> > Sorry, but I don't get the problem here... guile+serveez+anything
> > disappears completely on exec(). Actually, that's the reason of
> > existence for exec().
>
> exce() is not actually the problem, if Guile opens its files with the
> FD_CLOEXEC flag set. But we might get a problem if we want to fork (which
> is the case for the coservers).
> The actual problem occurs as follows: On Raimi's SMP machine the wait()
> for a child in the signal handler does not return until all file
> descriptors shared with other children are closed. So if guile is running
> and we fork a new coserver it gets guile's fds as well as any other
> coserver. Thus serveez hangs if one of the coservers dies.
> I do not know if this behaviour is correct (on my laptop everything is
> fine) and if it is correctly described anyway...
Guile has a procedure port-for-each, which allows to apply a procedure
to every open port. Oh, sorry for the Scheme speak -- a port is the
file abstraction for Scheme. So it is possible to explicitly close
all files (except for std{in,out,err}).
Example:
(port-for-each close-port)
This could be evaluated directly after the fork().
Regards,
'martin