On m�ndag, juli 22, 2002, at 04:26 , Elizabeth Mattijsen wrote:
> At 03:26 PM 7/22/02 +0200, Arthur Bergman wrote:
>>> Seem to be getting a problem when trying to share hashes, I think I am
>>> doing it write, or maybe this is a known problem?....This then
>>> returns:
>>> Invalid value for shared scalar at Thread/Manage.pm line 52.
>>> A thread exited while 4 other threads were still running.
>> Aside from the fact that $hash{$key} is a scalar :-), if $value is a
>> reference it needs to be shared for the assign to work.
>
> Which I understand why, but which I think is _the_ stumbling block with
> the current threads implementation. And which is something _everybody_
> will bang their head against when they start programming threads... ;-(
>
I don't think of it as a stumbling block, perhaps the error message
should have been a bit clearer :-).
I am fairly sure that
$hash{$key} = &share($value); will work.
Arthur