@{$self->{container}} share question
[email protected] ((David Shapiro))
| Newsgroups | perl.ithreads |
|---|---|
| Organization | PerlDiscuss.com |
| Message-ID | <[email protected]> |
This may have been beaten with a dead horse, but can anybody help with
this?
package test;
use strict;
use threads;
use threads:shared;
sub new {
my $class = shift;
$class = ref($class);
my $self = {};
# doesn't like the following in a shared scenario
@{$self->{container}} = ();
bless $self, $class;
return $self;
}
sub push : locked method {
my $self = shift;
my @stuff = ();
@stuff = @_;
if (scalar @stuff > 0) {
# whines about the @{$self->{container}} and sharing here. Why?
push(@{$self->{container}},@stuff);
}
}
1;