filelock

Lock a file from concurrent access
https://github.com/kevinresol/filelock

To install, run:

haxelib install filelock 0.1.0 

See using Haxelib in Haxelib documentation for more information.

README.md

filelock

Lock a file and prevents it from being accessed by others

Targets

At the moment only C++, Python, Java, NodeJS & PHP. But should be extendable to other targets.

Usage

FileLock.lock('my_file.txt').handle(function(o) switch o {
	case Success(lock):
		// do your work here
		lock.unlock;
	case Failure(err):
		trace(err)
});

Implementation

A .lock file is created when FileLock.lock() acquires the file lock. If the .lock file already exists, it means that the file has been locked by someone else. FileLock.lock() will keep trying to acquire the lock until it fails when the specified number of retries reached.

Note that the original file is NOT actually locked from any read/write operation.

Contributors
kevinresol
Version
0.1.0
Published
10 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂