Perl flock Function



Description

This function supports file locking on the specified FILEHANDLE using the system flock( ), fcntl( ) locking, or lockf( ). The exact implementation used is dependent on what your system supports. OPERATION is one of the static values defined here.

Operation	Result
LOCK_SH 	Set shared lock.
LOCK_EX 	Set exclusive lock.
LOCK_UN 	Unlock specified file.
LONG_NB 	Set lock without blocking.

Syntax

Following is the simple syntax for this function −

flock FILEHANDLE, OPERATION

Return Value

This function returns 0 on failure to set/unset lock and 1 on success to set/unset lock.

perl_function_references.htm
Advertisements