in reply to does an explicitly shared variable need locks?
#!/usr/bin/perl -w use threads; use threads::shared; my $i : shared = 0; push @t, threads->new( sub { $i++ for 1..100_000 } ) for 1..4; $_->join for @t; print "i=$i\n"; $ perl588t /tmp/p i=139728
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: does an explicitly shared variable need locks?
by gautam (Initiate) on Mar 12, 2006 at 11:46 UTC |