adilab / critical-section
Critical-section functionality for PHP
Installs: 6 376
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
This package is not auto-updated.
Last update: 2025-01-10 20:37:26 UTC
README
Allows create a critical section of code where only determine number of process can enter.
Installing
Preferred way to install is with Composer.
Install this library using composer:
$ composer require adilab/critical-section
Usage:
Usage in order to check if the process can entry into critical section.
require('vendor/autoload.php'); use Adi\System\CriticalSection; $cs = new CriticalSection(); if (!$cs->hasAccess()) die("There are other process in executing...\n"); echo "Processing...\n"; $cs = NULL; // Destructs (closes) the critical section.
The process can wait to of the performance critical section by other processes.
require('vendor/autoload.php'); use Adi\System\CriticalSection; $cs = new CriticalSection(); $cs->waitAccess(); echo "Processing...\n";