in reply to Re^2: Threading in a loop
in thread Threading in a loop
Your program finishes too fast. Try this:
use threads; use threads::shared; my $test :shared; $test = 0; testing_thread(); sub testing_thread { my $thr1 = threads->create(\&progress_count, $test); while ($test <= 1000000) { $test += 1; } $thr1->join(); } sub progress_count { while( $test < 1000000 ) { print $test, " \n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Threading in a loop
by jerre_111 (Sexton) on Apr 22, 2013 at 14:26 UTC | |
by hdb (Monsignor) on Apr 22, 2013 at 14:31 UTC | |
by jerre_111 (Sexton) on Apr 22, 2013 at 14:37 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2013 at 16:15 UTC | |
by CountOrlok (Friar) on Apr 22, 2013 at 14:50 UTC | |
by Anonymous Monk on Apr 22, 2013 at 15:09 UTC |
In Section
Seekers of Perl Wisdom