On Wed, Jul 24, 2002 at 10:24:53AM +0200, Elizabeth Mattijsen wrote:
> At 09:58 AM 7/24/02 +0200, Arthur Bergman wrote:
> >All my programs work with a master interpreter that has everything loaded
> >but hasn't done anything, and then new threads are spawned off from that.
> >All big data structures tend to be shared and as such do not need copying.
>
> So, in a threaded interpreter, it makes sense to make as much shared as
> possible to reduce memory requirements?
>
>
> >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
> }
one should be able to declare this for packages, outside these packages. i
guess that the clone-all strategy was chosen to make the transition to
ithreads when using old code easier. so the "new" program knows how to
handle the packages it uses, and which have to be cloned or not.
torvald