GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IO::Lambda::Flock(3) User Contributed Perl Documentation IO::Lambda::Flock(3)

IO::Lambda::Flock - lambda-style file locking

The module provides file locking interface for the lambda style, implemented by using non-blocking, periodic polling of flock(2).

    open LOCK, ">lock";
    lambda {
        # obtain the lock 
        context \*LOCK, timeout => 10;
        flock { die "can't obtain lock" unless shift }
        
        # while reading from handle
        context $handle;
        readable { ... }

        # and showing status 
        context 0.5;
        timeout { print '.'; again }
    };

flock($filehandle, %options) -> ($lock_obtained = 1 | $timeout = 0)
Waits until the file lock is obtained or the timeout is expired. When successful, the (shared or exclusive) lock on $filehandle is acquired by "flock($filehandle, LOCK_NB)" call. Options:
"timeout" or "deadline"
These two options are synonyms, both declare the moment when the lambda waiting for the lock should give up. If undef, timeout never occurs.
shared
If set, "LOCK_SH" is used, otherwise "LOCK_EX".
frequency
Defines how often the polling for the lock should occur. If left undefined, polling occurs during idle time, when other events are dispatched.

Fcntl, IO::Lambda::Poll.

Dmitry Karasik, <dmitry@karasik.eu.org>.
2012-03-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.