in reply to Re: Use thread with good care, but definitely keep using it
in thread Use thread with good care, but definitely keep using it

Yes, need to give it more time, but at the same time, should try it out, so more useful info can be feedback to the development.

Other than the cost of resource, if you ask me to pick one major problem, and only one. I would say that the biggest problem, according to my intensive trial with perl threading, is that bless is not implemented for threading.

Considering that lots of Perl modules are implemented as object, the bless problem simply made it impossible for you to share things among threads (of course you can share "prime" data types like scalar, array, hash etc.)

The problem with bless stops me from lots of experiments. As a supporter of perl threading, I hope they can resolve those major problems very soon.
  • Comment on Re: Re: Use thread with good care, but definitely keep using it

Replies are listed 'Best First'.
Re: Re: Re: Use thread with good care, but definitely keep using it
by Ctrl-z (Friar) on Mar 14, 2003 at 04:22 UTC
    do you have any more information/links on this bless issue?


    time was, I could move my arms like a bird and...
      The official doc is threads::shared, you can find info about this in the BUGS section.

      Whether there is any online article about this, I am not sure. You may give a search, if find any, please post links here, thanks.

      I created a short script to demo this, just uncomment either of the two commented lines. Compare the results from both cases. You will see that, if %hash itself is shared, you are not be able to assign $hash{VALUE} to an Object of Something correctly. Perl loses the object type, and simple coverts it into an unblessed hashref. Hence, you would not be able to call any method defined on that Object.
      use Something; use threads; use threads::shared; use strict; use warnings; #my %hash : shared; #my %hash; $hash{VALUE} = &share(new Something(1)); print $hash{VALUE}; package Something; sub new { shift; my $self = {}; $self->{VALUE} = shift; bless($self); return $self; } 1; 1;
        ouch!

        I thought I had read that before - but couldn't find it in perlthrtut, so just passed it off as a terrible fleeting delusion.


        time was, I could move my arms like a bird and...