Yes it does work, but in trying to share the object, the variables
within the object need to be shared to, I think, as when calling the
object later, the object was no longer blessed.

Rather than follow that line of thinking, The objects in question are no
longer shared, just owned by one thread, and anything wishing to
communicate with that thread does so through signals.  For this, I am
using Liz's Thread::Queue::Any, which I have literally just started
looking at and yet to get working.

The whole point of this is to create a method of dynamically creating
threads without having to replicate the whole process from the point you
called the new thread, plus add some other features such as thread
timeouts and run time.  It is quite specific to what we are doing, where
not all threads are required, but it would be nice to have their
results, if they take to long, we ignore them and let them finish up in
their own time.

Hmm, well, it makes sense to me :)

Ray


-----Original Message-----
From: Arthur Bergman [mailto:[EMAIL PROTECTED]] 
Sent: 22 July 2002 15:33
To: Elizabeth Mattijsen
Cc: Ray Hilton; [EMAIL PROTECTED]
Subject: Re: iThreads shared hashes


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


Reply via email to