Commit 33adfcea by resurtm

Autorelease callback.

parent 90227bd3
...@@ -34,10 +34,11 @@ abstract class Mutex extends Component ...@@ -34,10 +34,11 @@ abstract class Mutex extends Component
{ {
if ($this->autoRelease) { if ($this->autoRelease) {
$referenceHolder = new stdClass(); $referenceHolder = new stdClass();
$referenceHolder->mutex = &$this;
$referenceHolder->locks = &$this->_locks; $referenceHolder->locks = &$this->_locks;
register_shutdown_function(function ($ref) { register_shutdown_function(function ($ref) {
foreach ($ref->locks as $lock) { foreach ($ref->locks as $lock) {
$this->release($lock); $ref->mutex->release($lock);
} }
}, $referenceHolder); }, $referenceHolder);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment