Help for this page

Select Code to Download


  1. or download this
    $ perl -MConfig -le 'print $Config{d_flock}'
    define
    
  2. or download this
    $ ./locktest & sleep 4; ./locktest
    [1] 64228
    Using flock()...
    ...
    64233 owns
    64233 shares
    ^C
    
  3. or download this
    $ ./locktest & sleep 4; ./locktest
    [1] 64308
    Using flock()...
    ...
    64308 shares
    ^C
    $ kill %1
    
  4. or download this
    64310 shares.
    64310 waiting for previous instance(s) to exit...
    64308 owns
    
  5. or download this
    $ ./locktest 1 & sleep 4; ./locktest 1
    [1] 64442
    Using fcntl() locks...
    ...
    64446 owns
    64446 shares
    ^C
    
  6. 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
    
  7. or download this
    #!/usr/bin/perl -w
    #
    
    ...
        sleep $config{delay};
    }
    __END__