13dagger / mutex
Simple MutEx lock implementation based on directory creation
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/13dagger/mutex
Requires
- php: >=5.4
- ext-pcntl: *
- ext-posix: *
This package is auto-updated.
Last update: 2025-12-17 12:18:02 UTC
README
Simple MutEx lock implementation.
Gives you the easy way to check that your script runs as the only instance.
Basics
- try to lock, if ok -> run your program, else stop
- unlock when finished the job
Usage as php library
if (Mutex::lock('example_job')) {
// doing a job
}
by default library registers shutdown function to unlock, you can change this by changing the Mutex::$autoUnlock to
false and using Mutex::unlock() method
Usage as linux command
install:
./install
lock:
mutex lock some_action
unlock:
mutex unlock some_action