I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2009-06-24 16:29:46-07 by gulden
Threads + opendir = Segmentation Fault (core dumped)
I'm getting a "Segmentation Fault (core dumped) ", caused by "opendir" function, when running the folowing code:
#!/opt/coolstack/bin/perl use strict; use threads ('yield', 'stack_size' => 64*4096, 'exit' => 'threads_only', 'stringify'); #--------------------------------------------------------------- my $path = "/tmp"; my $time = time; #my @files = qw(detail-1min-19-06-22); my @files = &get_files($path); my @thrs_loaders; foreach my $file (@files){ my ($thr) = threads->create(\&load, $file); push @thrs_loaders, $thr; } $_->join for @thrs_loaders; exit; #--------------------------------------------------------------------- sub get_files{ my $dir = shift; opendir(DIR, $dir) or die "Cant open dir $!"; # HERE IS THE CAUSE close(DIR); return "detail-1min-19-06-22"; } #--------------------------------------------------------------------- sub load{ my $file = shift; print "Processing $file\n"; }

I've tested in:

$ perl -Mthreads -e 'print $threads::VERSION' 1.71 $ perl -v This is perl, v5.8.8 built for sun4-solaris-thread-multi
Any tips?
Direct Responses: 11045 | Write a response
Posted on 2009-06-24 17:42:03-07 by gulden in response to 11044
Re: Threads + opendir = Segmentation Fault (core dumped)
I've solved the problem with the help of PerlMonks in this node.
Direct Responses: Write a response