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

RE: Lexical Object copied to new thread

Thread Previous | Thread Next
Shmuel Fomberg
December 23, 2007 13:59
RE: Lexical Object copied to new thread
Message ID:
Hi Dave.

>> Anyway, my question is that $x is a lexical inside run_test, and as much
>> I understood it was not suppose to be copied to the new thread. But it

>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

On one hand, it does not make sense. Why should we copy variables (lexical)
that we can't access?
On the other hand, it is obvious. If we copy everything, then functions like
CLONE that are called package-wise, won't have to difference between lexical
created objects and global accessible objects. It's probably impossible too.

Thanks for getting things straight,

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