- or download this
$ perl -MConfig -le 'print $Config{d_flock}'
define
- or download this
$ ./locktest & sleep 4; ./locktest
[1] 64228
Using flock()...
...
64233 owns
64233 shares
^C
- or download this
$ ./locktest & sleep 4; ./locktest
[1] 64308
Using flock()...
...
64308 shares
^C
$ kill %1
- or download this
64310 shares.
64310 waiting for previous instance(s) to exit...
64308 owns
- or download this
$ ./locktest 1 & sleep 4; ./locktest 1
[1] 64442
Using fcntl() locks...
...
64446 owns
64446 shares
^C
- or download this
$ ( sleep 1; ./locktest 1 ) & sleep 8; ./locktest 1
[1] 64887
Using fcntl() locks...
...
64891 can't lock self: Resource temporarily unavailable
64890 shares
$ kill %1
- or download this
#!/usr/bin/perl -w
#
...
sleep $config{delay};
}
__END__