I'm using Kubuntu 8.01 and perl 5.10.0
The following code produces a Segmentation error and I don't have a clue as to why. I'm trying to run multiple threads on different pieces of the database, which is a hash of hashes. I need to do this in order to use more of my Quad core CPU to make my code run faster. I vaguely think there might be something about MLDBM that is thread intolerant. Any hints would be appreciated. thanks.
#! /usr/bin/perl -w
use strict;
use threads;
use MLDBM qw(DB_File Storable);
use Fcntl;
my $file = "/home/silly/g/data/100HOHsynTriNormCV.db";
my %syntrihash;
tie %syntrihash,'MLDBM',$file, O_RDONLY or die "tie failed for db $!\n
+";
my $checking = keys %syntrihash;
print "$checking\n";
my $thr1 = threads->create({'context' => 'array'}, \&subthr1, "test1")
+;
my @return1 = $thr1 -> join();
print "@return1 \n";
sub subthr1{
my ($message) = @_;
print "Thread Message is $message\n";
return (1,2,3);
}
Here is the result of running the program:
silly@bluetit:~/perl/threads$ thread.pl
100
Thread Message is test1
1 2 3
Segmentation fault