Re: RFC 178 (v1) Lightweight Threads
[email protected] (Chaim Frenkel) 02 Sep 2000 22:36:34 -0400
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "SWM" == Steven W McDougall <[email protected]> writes: >> Not unless it is so declared my $a :shared. SWM> Sure it is. SWM> Here are some more examples. SWM> Example 1: Passing a reference to a block-scoped lexical into a thread. Depends on how locking/threading is designed. There is a fundemental issue on how values are passed between threads. Does the value leave one thread and enter the other or are they shared. The idea tossed around -internals was that a value that crosses a thread boundary would have a wrapper/proxy attached to handle the mediation. The mediation would be activated only if the value is passed via a shared variable. In your case the shared variable is the argument being passed through the thread creation call. SWM> Example 2: Declaring one subroutine within the scope of another If we don't require a :shared on variable anything and everything has to have protection. If you want the variable to be shared declare it. SWM> Example 3: Closures (Ken's example) Aha, I get it. -internals has been assuming that one _must_ specify the sharing. You want it to be infered. I think that's asking for too much DWIMery. <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. [email protected] +1-718-236-0183