develooper Front page | perl.ithreads | Postings from December 2007

Re: Lexical Object copied to new thread

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 23, 2007 14:16
Subject:
Re: Lexical Object copied to new thread
Message ID:
20071223221219.GD23125@iabyn.com
On Sun, Dec 23, 2007 at 11:59:21PM +0200, Shmuel Fomberg wrote:
> Hi Dave.
> 
> >> Anyway, my question is that $x is a lexical inside run_test, and as much
> >>as
> >> I understood it was not suppose to be copied to the new thread. But it
> >is.
> 
> >In a new thread, *everything* is copied, apart from the calling stacks.
> 
> Well, It seen that the calling stack is copied too. But it kept frozen until
> the thread is destroyed, and then Perl destroy the calling stack frame by
> frame. 

Um no, lexical variables aren't stored on the call stack. The stack isn't
copied (so caller() in a thread won't show any history outside the thread
itself), but all lexicals are cloned.

-- 
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. -- "Bored of the Rings"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About