Subject: | Please make module thread safe |
Date: | Thu, 2 Nov 2006 08:22:46 -0800 (PST) |
To: | bug-set-object [...] rt.cpan.org |
From: | Andy <gmlvsk [...] yahoo.com> |
use strict;
use threads;
use threads::shared;
use Set::Object;
my $sh = new Set::Object();
share($sh);
my $t1 = threads->new(\&f1);
my $t2 = threads->new(\&f2);
main();
$t1->join;
$t2->join;
sub f1{
foreach my $i (1..10000000){
my $d = $i % 10;
$sh->remove($d) if $sh->element($d);
}
}
sub f2{
foreach my $i (1..10000000){
my $d = $i % 10;
$sh->remove($d);
}
}
sub main{
my $d;
foreach my $i (1..10000000){
my $d = $i % 10;
$sh->insert($d);
}
}
Attempt to free non-existent shared string '1', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '2', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '3', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '4', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '5', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '6', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '7', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '8', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '9', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '1', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '2', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '3', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '4', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '5', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '6', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '7', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '8', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '9', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '1', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '2', Perl interpreter: 0x9ab0518 at
tmp.pl line 21.
Attempt to free non-existent shared string '3', Perl interpreter: 0x9ab0518 at
Show quoted text
____________________________________________________________________________________
Low, Low, Low Rates! Check out Yahoo! Messenger's cheap PC-to-Phone call rates
(http://voice.yahoo.com)