sub create_link($) { my $filehandle = shift(@_); my $max_wartezeit = 3; my $fehler = ''; sysopen ($filehandle, "sysopentest.txt", O_RDWR | O_CREAT, 0600) or $fehler = $!; if (!$fehler) { my $start = time; while(!flock($filehandle,LOCK_EX|LOCK_NB) && time-$start<$max_wartezeit){ sleep 1; } $fehler = 'Timeout on flock' if !flock ($filehandle, LOCK_EX | LOCK_NB); } return $fehler; }