Browse Source

Autorelease callback.

tags/2.0.0-beta
resurtm 12 years ago
parent
commit
33adfcea91
  1. 3
      extensions/mutex/yii/mutex/Mutex.php

3
extensions/mutex/yii/mutex/Mutex.php

@ -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);
}

Loading…
Cancel
Save