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

RE: Lexical Object copied to new thread

Thread Previous | Thread Next
From:
Shmuel Fomberg
Date:
December 23, 2007 13:59
Subject:
RE: Lexical Object copied to new thread
Message ID:
000801c845af$133edf60$6801a8c0@semuel7
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. 

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,
Shmuel.




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