Re: subprocesses lifecycle
- From: xhoster@xxxxxxxxx
- Date: 31 Aug 2008 02:58:08 GMT
Eric Pozharski <whynot@xxxxxxxxxxxxxx> wrote:
And what surprises me most is that, as Hans Mulder discovered, lexical
filehandles are waited, globals are not. Wouldn't someone willing to dig
through source and explain why that's that way?
I am guessing it is because lexicals are destroyed when they go out of
scope, while globals are only destroyed during "global destruction", during
which time the automatic waiting behavior may not be working.
If one uses circular refs to prevent a lexical filehandle from going out of
scope until global destruction, they don't wait. For example,
the below exits immediately:
perl -le ' my @y; open $y[0], "sleep 5 |" or die; push @y,\@y'
Sometimes it waits anyway. Global destruction is hard to predict.
This waits:
perl -le ' my @y; open $y[0], "sleep 5 |" or die; push @y,\@y; $z=bless {}'
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
.
- References:
- subprocesses lifecycle
- From: Matthieu Imbert
- Re: subprocesses lifecycle
- From: Eric Pozharski
- Re: subprocesses lifecycle
- From: Eric Pozharski
- subprocesses lifecycle
- Prev by Date: Multiple processes and tie'd files
- Next by Date: Re: Multiple processes and tie'd files
- Previous by thread: Re: subprocesses lifecycle
- Next by thread: FAQ 8.1 How do I find out which operating system I'm running under?
- Index(es):
Relevant Pages
|