IPC-ScoreBoard

 view release on metacpan or  search on metacpan

t/IPC-ScoreBoard.t  view on Meta::CPAN

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
skip "environment variable STRESSTEST not set or incr ops are not atomic", 1
  unless SB::have_atomics && $ENV{STRESSTEST};
 
@pids=();
for(my $i=0; $i<10; $i++) {
  my $pid;
  select undef, undef, undef, 0.1 until defined($pid=fork);
  if( $pid ) {                        # parent
    push @pids, $pid;
  } else {                            # child
    1 until SB::get_extra $sb, 0; # busy wait
 
    for( my $i=0; $i<1000000; $i++ ) {
      SB::incr_extra $sb, 1;
    }
 
    exit 0;
  }
}
SB::incr_extra $sb, 0;        # start children



( run in 0.233 second using v1.01-cache-2.11-cpan-8d75d55dd25 )