develooper Front page | perl.perl5.porters | Postings from August 2009

Re: [perl #66158] fork crashes on perl 5.10.0/Win32 [PATCH proposal]

Vincent Pit
August 5, 2009 06:11
Re: [perl #66158] fork crashes on perl 5.10.0/Win32 [PATCH proposal]
Message ID:
> So if I understand it correctly, Variable::Magic has been made to work
> under threads by making use of the thread's ptr_table, which is kept
> around after a new thread is created. However, fork() under windows is
> emulated by using the same threading mechanism that uses
> but it doesn't keep the ptr_table around (and never has). Variable::Magic
> can't distinguish between a thread clone and a fork clone, and assumes
> that the ptr_table is always around, and thus explodes.

Yes, exactly. Variable::Magic stores coderefs in a thread local context.
When a new interpreter is cloned, it needs to relink the old pointers to
their cloned counterparts. Hence it relies on hitting the pointer table in

> The thing that puzzles me is that is doesn't explode on 5.8.x.

I've no idea about why it works with 5.8, nor why the pointer table is
flushed for the fork emulation but not for threads.

Vincent. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About