mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-19 01:34:44 +08:00
Autorelease callback.
This commit is contained in:
@ -34,10 +34,11 @@ abstract class Mutex extends Component
|
||||
{
|
||||
if ($this->autoRelease) {
|
||||
$referenceHolder = new stdClass();
|
||||
$referenceHolder->mutex = &$this;
|
||||
$referenceHolder->locks = &$this->_locks;
|
||||
register_shutdown_function(function ($ref) {
|
||||
foreach ($ref->locks as $lock) {
|
||||
$this->release($lock);
|
||||
$ref->mutex->release($lock);
|
||||
}
|
||||
}, $referenceHolder);
|
||||
}
|
||||
|
Reference in New Issue
Block a user