vlingvo has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am writing fairly large program using ActiveState Perl 5.8 build 806 Win2k, and when i am trying to use threads i got this error : Free to wrong pool 15dda38 not 15d4240 during global destruction Threads created o.k but it happens when i try to join them i have this error and it just dies . I have scaled down my program to provide test case to test problem.please remember this is a test case so there no much sence in it :)
Thanks

use strict; use threads; mxu_install(); sub mxu_install { my $count=0; my $kit_temp=$ARGV[0]; if(!opendir(MXU_DIR,"$kit_temp/MXU")) { print "Can't open $kit_temp/MXU: $!"; } while( defined (my $file = readdir MXU_DIR) ) { next if $file =~ /^\.\.?$/; install_mxu_comp(); return; } closedir(MXU_DIR); } sub install_mxu_comp { my $count=0; $|=1; my $thread1 = threads->new(\&blah); my $thread2=threads->new(\&blah); $thread1->join(); $thread2->join(); print "Father exiting\n"; return 0; } sub blah { print "inthread\n"; sleep(5); }

Replies are listed 'Best First'.
Re: threads problem
by nite_man (Deacon) on Jul 23, 2003 at 13:53 UTC
    Try to look at this topic, maybe it will help you resolve your problem.
          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);
    
      Thanks , I tryed to modify my code and when i remove directory part completly it works.it doesn't make sense to me.
Re: threads problem
by Anonymous Monk on Jul 23, 2003 at 14:53 UTC
    I changed my code so filedescriptor will be closed before threads starts and it works , so why this strange behavier ? i thought that filedescriptors r duped per thread on windows
    use strict; use warnings; use threads; mxu_install(); sub mxu_install { my $count=0; my $kit_temp=$ARGV[0]; if(!opendir(MXU_DIR,"$kit_temp/MXU")) { print "Can't open $kit_temp/MXU: $!"; } while( defined (my $file = readdir MXU_DIR) ) { next if $file =~ /^\.\.?$/; } closedir(MXU_DIR); install_mxu_comp(); return; } sub install_mxu_comp { my $count=0; $|=1; my $thread1 = threads->new(\&blah); my $thread2=threads->new(\&blah); $thread1->join(); $thread2->join(); print "Father exiting\n"; return 0; } sub blah { print "inthread\n"; sleep(5); }