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

In reply to If I am tied to a db and I join a thread, program chrashes by lance0r

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.