On Wed Sep 01 10:03:57 2010, strop wrote: > This is a bug report for perl from sinantrop@gmail.com, > generated with the help of perlbug 1.39 running under perl 5.12.1. > > This program crashes perl on windows with those messages: > Free to wrong pool 18247e8 not 245a60 at 1.pl line 11. > Free to wrong pool 1859c50 not 245a60 at 1.pl line 11. > > sub ListDir > { > my ($dir, $proc)=@_; > > local *DH; > opendir(DH,$dir); > while(my $fn=readdir(DH)) > { > &$proc($fn, $dir); > } > closedir(DH); > } > > ListDir(".", sub > { > my ($fn, $dir)=@_; > print "$dir/$fn\n"; > > fork; > }); > --- I'm not sure that it is a good idea to mix dirhandles and fork/threads. This program works correctly: sub ListDir { my ($dir, $proc)=@_; opendir(my $dh,$dir); my @files=readdir($dh); closedir($dh); foreach my $fn (@files) { $proc->($fn, $dir); } } ListDir(".", sub { my ($fn, $dir)=@_; print "$dir/$fn\n"; fork; }); It's result are meaningless though - for last file $proc will be executed 2^N times, where N is numner of files. -- Alexandr Ciornii, http://chorny.netThread Previous