dev-master
9999999-dev https://github.com/gielfeldt/lockLock library.
MIT
The Requires
- php >=5.4.0
- gielfeldt/shutdownhandler ~1.0
by Thomas Gielfeldt
lock mutex semaphore
Wallogit.com
2017 © Pedro Peláez
Lock library.
[][12]
[
][12], (*3)
To install the Lock library in your project using Composer, first add the following to your composer.json
config file., (*4)
{
"require": {
"gielfeldt/lock": "~1.0"
}
}
Then run Composer's install or update commands to complete installation. Please visit the Composer homepage for more information about how to use Composer., (*5)
This lock handler ..., (*6)
namespace Gielfeldt\Lock\Example;
require 'vendor/autoload.php';
use Gielfeldt\Lock;
$lockService = new Lock\LockService([
'storage' => new Lock\Storage\Memory(),
]);
print "'mylock' is locked: " . $lockService->isLocked('mylock') . "\n";
print "Locking 'mylock'\n";
$lock = $lockService->acquire('mylock');
print "'mylock' is locked: " . $lockService->isLocked('mylock') . "\n";
$lock->bind('release', function ($lock) {
print "RELEASE EVENT 2: " . $lock->getName() . "\n";
});
$lock->release();
print "'mylock' is locked: " . $lockService->isLocked('mylock') . "\n";
For more examples see the examples/ folder., (*7)
Lock library.
MIT
lock mutex semaphore