FCF 2.0 development in progress...
> >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

Package fcf-framework-lock

The package provides locking functions on a file using the flock or LockFileEx function.
Functions
[SERVER ONLY] fcf.NLock.lockFile(string a_filePath, function a_cb)
[SERVER ONLY] fcf.NLock.lockFile(number a_fileHandle, function a_cb)
- Performs file locking using the flock or LockFileEx function
[SERVER ONLY] fcf.NLock.tryLockFile(string a_filePath, function a_cb)
[SERVER ONLY] fcf.NLock.tryLockFile(number a_fileHandle, function a_cb)
[SERVER ONLY] fcf.NLock.tryLockFile(string a_filePath, boolean a_quiet, function a_cb)
[SERVER ONLY] fcf.NLock.tryLockFile(number a_fileHandle, boolean a_quiet, function a_cb)
- Performs a lock on the file, if the lock is already on the file, then the function fails or returns the lock identifier to undefined, depending on the a_quiet argument
[SERVER ONLY] fcf.NLock.unlockFile(number a_lock, function a_cb)
- Removes a locks on a file
[SERVER ONLY] fcf.NLock.isLockFile(string a_filePath, function a_cb)
[SERVER ONLY] fcf.NLock.isLockFile(number a_fileHandle, function a_cb)
- Checks if a file is locked.
[SERVER ONLY] fcf.NLock.lockNamedMutex(string a_name, function a_cb)
- Performs a lock on a named mutex
[SERVER ONLY] fcf.NLock.tryLockNamedMutex(string a_name, function a_cb)
[SERVER ONLY] fcf.NLock.tryLockNamedMutex(string a_name, boolean a_quiet, function a_cb)
- Locks a named mutex without waiting. If the mutex is already locked, the function fails and the error object contains the unavailable field set to true. If a_quiet is true, then if the mutex is already locked, the function calls the callback with a lock index value of undefined.
[SERVER ONLY] fcf.NLock.unlockNamedMutex(number a_lock, function a_cb)
- Performs a mutex unlock
[SERVER ONLY] fcf.NLock.isLockNamedMutex(string a_name, function a_cb)
- Checks whether the named mutex is locked