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


Manual Reference Pages  -  UBIC::LOCKF (3)

.ds Aq ’

NAME

Ubic::Lockf - file locker with an automatic out-of-scope unlocking mechanism

CONTENTS

VERSION

version 1.58

SYNOPSIS



    use Ubic::Lockf;
    $lock = lockf($filehandle);
    $lock = lockf($filename);
    undef $lock; # unlocks either



DESCRIPTION

lockf is a perlfunc flock wrapper. The lock is autotamically released as soon as the associated object is no longer referenced.

METHODS

<B>lockf($file, B>$options<B>)B> Create an Lockf instance. Always save the result in some variable(s), otherwise the lock will be released immediately.

The lock is automatically released when all the references to the Lockf object are lost. The lockf mandatory parameter can be either a string representing a filename or a reference to an already opened filehandle. The second optional parameter is a hash of boolean options. Supported options are:
shared OFF by default. Tells to achieve a shared lock. If not set, an exclusive lock is requested.
blocking ON by default. If unset, a non-blocking mode of flock is used. If this flock fails because the lock is already held by some other process, undef is returned. If the failure reason is somewhat different, permissions problems or the absence of a target file directory for example, an exception is raised.
timeout Undef by default. If set, specifies the wait timeout for acquiring the blocking lock. The value of 0 is equivalent to blocking => 0 option.
mode Undef by default. If set, a chmod with the specified mode is performed on a newly created file. Ignored when filehandle is passed instead of a filename.

<B>B>name()<B>B> Gives the name of the file, as it was when the lock was taken.
<B>B>dissolve()<B>B> Destroy lock object without unlocking.

This is useful in forking code, if you have one lock object in several processes and want to close locked fh in one process without unlocking in the other.

AUTHOR

Vyacheslav Matyukhin <mmcleric@yandex-team.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Yandex LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

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


perl v5.20.3 UBIC::LOCKF (3) 2015-01-27

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