P0w3rK!d has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to run an application that will create multiple threads, do work for all the threads, cleanup the threads with a join, and repeat. I get the following error:
What can I do to work around this problem? There was only one post associated with this and it did not answer my questions."Free to wrong pool 1e76ba8 not 15d26e8 during global destruction."
Thanks :)use threads; use threads::shared; our $SHARED_DATA : shared; our @threads = (); # threads our $FINISHED : shared = 0; # for simulation state main(); main ( process() ) init( for () { push @threads, threads->new (\&Foo::run()...); } ) process( init(); finish(); ) sub finish { # our (@threads); { lock $FINISHED; $FINISHED = 1; } $_->join for @threads; } ################### # my class ################### package Foo; use threads; use threads::shared; sub new {} sub run { dothings() {lock $FINISHED; return if $FINISHED;} } sub dothings { lock ($SHARED_DATA); # ... }
-P0w3rK!d
Minor edit per author - dvergin 2003-06-06
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Threads: Free to wrong pool
by BrowserUk (Patriarch) on Jun 06, 2003 at 14:44 UTC | |
by P0w3rK!d (Pilgrim) on Jun 06, 2003 at 14:55 UTC | |
by P0w3rK!d (Pilgrim) on Jun 06, 2003 at 15:02 UTC | |
by BrowserUk (Patriarch) on Jun 06, 2003 at 15:39 UTC | |
by P0w3rK!d (Pilgrim) on Jun 07, 2003 at 00:32 UTC | |
by BrowserUk (Patriarch) on Jun 07, 2003 at 06:10 UTC | |
by P0w3rK!d (Pilgrim) on Jun 06, 2003 at 15:39 UTC |