At 10:24 AM 7/24/02 +0200, Elizabeth Mattijsen wrote:
>>In the future I hope to be able to clone just specific data that is 
>>needed for a thread, how this is supposed to work isn't really thought 
>>out yet, ideas welcome.
>I was thinking of a combination of a new pragma (or possibly a parameter 
>to thread::shared) and a new attribute.
>The attribute would be ": private", the opposite of shared.  The pragma 
>would set the default for variables defined in the scope, to be either 
>shared or thread private.
>
>So:
>
>    sub name {
>        use threads::shared ':all';
>        my $scalar;           # would have : shared attribute
>        my $other : private;  # would _not_ have : shared attribute
>    }

Actually, I think we need a third attribute: ': public'.

   public        current state if not shared: copied when cloning
   shared        accessible to all threads, not copied
   private       only accessible in thread, not copied

An execution error should occur when you try to access a variable marked 
"private" that was not copied to your thread.


Liz

Reply via email to