At 12:23 AM 8/10/02 +0200, Arthur Bergman wrote:
>>Shared variables in this approach are truly shared. The value of a variable
>>only exists once in memory. This implementation also circumvents the memory
>>leak that currently (threads::shared version 0.90) plagues any shared array
>>or shared hash access.
>You will find that this is not true :-(, mostly because of perl deals with
>tieing.
>
>Perl will always copy the result from a tied call into the variable that
>is tied.
>
>so in effect
>
>tie $foo, "Tie";
>
>sub Tie::FETCH {
> return "hi";
>}
>
>will result in
>
>print $foo;
>
>not being print tied($foo)->FETCH(); but rather that it will be
>
>$foo = tied($foo)->FETCH; print $foo;
>
>so before every access to the tied object, FETCH is called and the return
>value is copied into the tied variable which is then used as a normal perl
>variable.
>
>this is why I want to replace magic with PMC, this is also why tied
>variables are 2x as slowas doing tied($foo)->FETCH directly
Ah.. ok... I didn't know that.
But at least the value will only be copied to the thread that actually
requests it, so that is a saving I would think?
Liz