IPC-ScoreBoard

 view release on metacpan or  search on metacpan

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

  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.885 second using v1.01-cache-2.11-cpan-87723dcf8b7 )