Martin G Dixon <mgdixon / ichips.intel.com> wrote:
>I ran into a bug (feature?) in Tempfile/fork interaction. Specifically, my
>Tempfile gets deleted once a fork exits. Presumably, the finalizer is being
>called for the child process which is what actually does the deletion. Is
>this how it's "supposed" to work?

When you fork, the child gets its own copies of all open
filehandles.  Therefore the automatic cleanup will fire
whenever either parent or child exits.

One way to resolve this would be to make the current
pid (ie $$) be an attribute of a Tempfile and have the
cleanup code only clean things up when $$ matches what
the attribute.  Therefore the child would not cleanup
the parent's temporary files.

Cheers,
Ben

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com