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
}
Liz