stas        2003/09/24 12:04:59

  Modified:    t/response/TestPerl ithreads.pm
  Log:
  'sub : locked {} ' doesn't do anything with ithreads perl, need to
  explicitly lock a shared lock to ensure thread-safety.
  
  Revision  Changes    Path
  1.5       +4 -4      modperl-2.0/t/response/TestPerl/ithreads.pm
  
  Index: ithreads.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestPerl/ithreads.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- ithreads.pm       4 Sep 2003 04:31:45 -0000       1.4
  +++ ithreads.pm       24 Sep 2003 19:04:59 -0000      1.5
  @@ -49,16 +49,16 @@
           require threads::shared;
           my $counter_priv          = 1;
           my $counter_shar : shared = 1;
  -        my $thr = threads->new(sub : locked {
  -                                   my $tid = threads->self->tid; 
  +        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;
  -                                   return 2;
                                  });
           $counter_priv += $counter_priv for 1..10;
           $counter_shar += $counter_shar for 1..10;
  -        my $ret = $thr->join;
  +        $thr->join;
           ok t_cmp(2**20, $counter_shar, "shared counter");
           ok t_cmp(2**10, $counter_priv, "private counter");
       }
  
  
  

Reply via email to