Skip to content

boo1ean/semaphore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keep your thread locked!

This package provide simple semaphore wrapper which can work different adapters

Basic usage

<?php

use Semaphore\Semaphore;

$lock = new Semaphore();
$key  = 'oh no!';

if ($lock->locked($key) {
	// Meh, it's so locked...
} else {
	// Lock semaphore
	$lock->lock($key);

	// Do thread-safe operations
	reallyImportantCriticalStuff();

	// Release lock
	$lock->unlock($key);
}

About

Don't let your app be afraid of parallel execution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages