PHP code example of adilab / critical-section

1. Go to this page and download the library: Download adilab/critical-section library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adilab / critical-section example snippets




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.



use Adi\System\CriticalSection;

$cs = new CriticalSection();
$cs->waitAccess();
echo "Processing...\n";