Author: stas Date: Wed Dec 8 13:20:31 2004 New Revision: 111314 URL: http://svn.apache.org/viewcvs?view=rev&rev=111314 Log: reformat the test a bit
Modified: perl/modperl/trunk/t/response/TestPerl/ithreads.pm Modified: perl/modperl/trunk/t/response/TestPerl/ithreads.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestPerl/ithreads.pm?view=diff&rev=111314&p1=perl/modperl/trunk/t/response/TestPerl/ithreads.pm&r1=111313&p2=perl/modperl/trunk/t/response/TestPerl/ithreads.pm&r2=111314 ============================================================================== --- perl/modperl/trunk/t/response/TestPerl/ithreads.pm (original) +++ perl/modperl/trunk/t/response/TestPerl/ithreads.pm Wed Dec 8 13:20:31 2004 @@ -38,10 +38,10 @@ { my $thr = threads->new(sub { - my $tid = threads->self->tid; - debug "2nd TID is $tid" if defined $tid; - return 2; - }); + my $tid = threads->self->tid; + debug "2nd TID is $tid" if defined $tid; + return 2; + }); ok t_cmp($thr->join, 2, "thread callback returned value"); } @@ -49,18 +49,23 @@ require threads::shared; my $counter_priv = 1; my $counter_shar : shared = 1; + my $thr = threads->new(sub { - my $tid = threads->self->tid; - debug "2nd TID is $tid" if defined $tid; - $counter_priv += $counter_priv for 1..10; - lock $counter_shar; - $counter_shar += $counter_shar for 1..10; - }); + my $tid = threads->self->tid; + debug "2nd TID is $tid" if defined $tid; + $counter_priv += $counter_priv for 1..10; + { + lock $counter_shar; + $counter_shar += $counter_shar for 1..10; + } + }); + $counter_priv += $counter_priv for 1..10; { lock $counter_shar; $counter_shar += $counter_shar for 1..10; } + $thr->join; ok t_cmp($counter_shar, 2**20, "shared counter"); ok t_cmp($counter_priv, 2**10, "private counter");