When you execute the following code you get a synchronised counting/printing action
use threads; use threads::shared; my $test :shared; $test = 0; testing_thread(); sub testing_thread { while ($test <= 100) { my $thr1 = threads->create(\&progress_count, $test); $test += 1; $thr1->join(); } } sub progress_count { print $test, " \n"; }
In reply to Re^6: Threading in a loop
by jerre_111
in thread Threading in a loop
by jerre_111
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |