sub create_link($) { my $fh = shift(@_); my $max = 10; my $err = ''; sysopen($fh, "sysopentest.txt",O_RDWR|O_CREAT,0600) or $err=$!; if (!$err) { my $start = time; my $flock = flock($fh,LOCK_EX|LOCK_NB); while (!$flock && time-$start < $max) { print "Flock: >$flock< warte 1\n"; sleep 1; $flock = flock($fh,LOCK_EX|LOCK_NB); } $err = 'Timeout on flock' if !$flock; } return $err; }