Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Ubic::Lockf(3)	      User Contributed Perl Documentation	Ubic::Lockf(3)

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

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
       lockf($file, $options)
	   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.

       name()
	   Gives the name of the file, as it was when the lock was taken.

       dissolve()
	   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.

perl v5.24.1			  2015-01-27			Ubic::Lockf(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | METHODS | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Ubic::Lockf&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help