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  -  PERLIO::FLOCK (3)

.ds Aq ’

NAME

PerlIO::flock - Easy flock() interface

CONTENTS

SYNOPSIS



        open my $in,  < :flock, $file; # shared lock
        open my $out, +<:flock, $file; # exclusive lock

        binmode($fh, :flock(blocking));
        binmode($fh, :flock(non-blocking));



DESCRIPTION

PerlIO::flock provides an interface to flock().

It tries to lock the filehandle with flock() according to the open mode. That is, if a file is opened for writing, :flock attempts exclusive lock (using LOCK_EX). Otherwise, it attempts shared lock (using LOCK_SH).

It waits until the lock is granted. If an argument non-blocking (or LOCK_NB) is supplied, the call of open() (or binmode()) fails when the lock cannot be granted.

This is a pseudo layer that doesn’t be pushed on the layer stack.

EXAMPLE



        # tries shared lock, or waits until the lock is granted
        open my $in, "<:flock", $file;
        open my $in, "<:flock(blocking)", $file;     # ditto.

        # tries shared lock, or returns undef
        open my $in, "<:flock(non-blocking)", $file;
        open my $in, "<:flock(LOCK_NB)", $file;      # ditto.



SEE ALSO

PerlIO::Util.

flock in perlfunc.

AUTHOR

Goro Fuji (X XX) <gfuji (at) cpan.org>

LICENSE AND COPYRIGHT

Copyright (c) 2008, Goro Fuji <gfuji (at) cpan.org>. Some rights reserved.

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

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


perl v5.20.3 PERLIO::FLOCK (3) 2011-05-25

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