Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

wincache_lock(3) [php man page]

WINCACHE_LOCK(3)							 1							  WINCACHE_LOCK(3)

wincache_lock - Acquires an exclusive lock on a given key

SYNOPSIS
bool wincache_lock (string $key, [bool $isglobal = false]) DESCRIPTION
Obtains an exclusive lock on a given key. The execution of the current script will be blocked until the lock can be obtained. Once the lock is obtained, the other scripts that try to request the lock by using the same key will be blocked, until the current script releases the lock by using wincache_unlock(3). Warning Using of the wincache_lock(3) and wincache_unlock(3) can cause deadlocks when executing PHP scripts in a multi-process environment like FastCGI. Do not use these functions unless you are absolutely sure you need to use them. For the majority of the operations on the user cache it is not necessary to use these functions. PARAMETERS
o $key - Name of the key in the cache to get the lock on. o $isglobal - Controls whether the scope of the lock is system-wide or local. Local locks are scoped to the application pool in IIS FastCGI case or to all php processes that have the same parent process identifier. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Using wincache_lock(3) <?php $fp = fopen("/tmp/lock.txt", "r+"); if (wincache_lock("lock_txt_lock")) { // do an exclusive lock ftruncate($fp, 0); // truncate file fwrite($fp, "Write something here "); wincache_unlock("lock_txt_lock"); // release the lock } else { echo "Couldn't get the lock!"; } fclose($fp); ?> SEE ALSO
wincache_unlock(3), wincache_ucache_set(3), wincache_ucache_get(3), wincache_ucache_delete(3), wincache_ucache_clear(3), win- cache_ucache_exists(3), wincache_ucache_meminfo(3), wincache_ucache_info(3), wincache_scache_info(3). PHP Documentation Group WINCACHE_LOCK(3)

Check Out this Related Man Page

ost::Lockfile(3)					     Library Functions Manual						  ost::Lockfile(3)

NAME
ost::Lockfile - This class is used to create a 'named' lock entity that can be used to control access to a resource between multiple processes. SYNOPSIS
#include <process.h> Public Member Functions Lockfile (const char *name) Create a lock under a known name. Lockfile () Create a new lock object that can be used to make locks. ~Lockfile () Destroy the current lock and release it. bool lock (const char *name) Lock a system-wide name for this process. void unlock (void) Release an acquired lock. bool isLocked (void) Flag if the current process has aqcuired a lock. Detailed Description This class is used to create a 'named' lock entity that can be used to control access to a resource between multiple processes. The posix implimentation uses a pidfile and the win32 version uses a globally visible mutex. Author: David Sugar dyfet@ostel.com System-wide named lock Constructor &; Destructor Documentation ost::Lockfile::Lockfile (const char *name) Create a lock under a known name. Parameters: name of system-wide lock to create. ost::Lockfile::Lockfile () Create a new lock object that can be used to make locks. ost::Lockfile::~Lockfile () [inline] Destroy the current lock and release it. Member Function Documentation bool ost::Lockfile::isLocked (void) Flag if the current process has aqcuired a lock. Returns: true if we have the lock. bool ost::Lockfile::lock (const char *name) Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it first. Returns: true if lock successful. Parameters: name system-wide lock to use. void ost::Lockfile::unlock (void) Release an acquired lock. Author Generated automatically by Doxygen for GNU CommonC++ from the source code. GNU CommonC++ Sat Jun 23 2012 ost::Lockfile(3)
Man Page