Re: RFC 178 (v2) Lightweight Threads
[email protected] (Chaim Frenkel) 04 Sep 2000 20:25:24 -0400
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "PRL" == Perl6 RFC Librarian <[email protected]> writes: PRL> All threads see the same compiled subroutines Why? Why not allow two different threads to have a different view of the universe? PRL> All threads share the same global variables _All_ or only as requested by the user (ala :shared)? PRL> Threads can create thread-local storage by C<local>izing global variables I'd prefer the other way. Sharing has to be declared. Much less work on the -internals folks. Much less handshaking has to go on. In otherwords privacy is the default. PRL> All threads share the same file-scoped lexicals Same issues a Globals. Privacy should be the default. PRL> Each thread gets its own copy of block-scoped lexicals upon execution PRL> of C<my> Why? Perhaps I want a shared my? PRL> Threads can share block-scoped lexicals by passing a reference to a PRL> lexical into a thread, by declaring one subroutine within the scope of PRL> another, or with closures. Sounds complex to me. Why not make it simply visible by marking it as such? PRL> The interpreter guarantees data coherence It can't, don't even try. What if I need two or more variables kept in sync. The user has to mediate. Perl can't determine this. Perhaps, I'm archaic, but I really wouldn't mind if the thread model basically copied the fork() model and required those variable that have to live across threads to be marked as :shared. <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. [email protected] +1-718-236-0183