[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[Id: 19991025.003] Race condition in devel branch?



The appended skript prints
 ,-----
 | 1..2
 | ok 1
 `-----
with the offending versions. Removing the "open" line
produces the expected
 ,-----
 | 1..2
 | ok 1
 | ok 2
 `-----
(On Solaris 2.6)
Uli
------------------------------------------------------------------------
#!perl 

print "1..2\n"; $n=1;
my $pid = open(PIPE_TO_KID, "|-");
if (not defined $pid) {
  die "Failed to fork: $!";
} elsif (not $pid) {
  # child loop: handle any data that is fed to the process via STDIN
  my $slot;
  while (<>) {
    $fh[++$slot] = "$slot";
    my $pipe = "|gzip -c >file.".sprintf("%04d", $slot).".gz";
    print "ok $n\n"; $n++;
    open($fh[$slot], $pipe) or die "Could not open pipe $pipe: $!";
  }
} else {
  print PIPE_TO_KID "0\n1\n";
}


References to:
Ulrich Pfeifer <upf@de.uu.net>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]