You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* @link http://www.yiiframework.com/
|
|
|
|
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
|
|
|
|
* @license http://www.yiiframework.com/license/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace yii\mutex;
|
|
|
|
|
|
|
|
|
|
use Yii;
|
|
|
|
|
use yii\base\Component;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mutex component allows mutual execution of the concurrent processes, preventing "race conditions".
|
|
|
|
|
* This is achieved by using "lock" mechanism. Each possibly concurrent thread cooperates by acquiring
|
|
|
|
|
* the lock before accessing the corresponding data.
|
|
|
|
|
*
|
|
|
|
|
* Usage example:
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* if ($mutex->acquire($mutexName)) { |