1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-30 04:39:01 +01:00

Use synchronized() instead of lock()/unlock()

This commit is contained in:
Aaron Piotrowski 2015-08-27 14:34:50 -05:00
parent 3dce08de42
commit c7dbf7394f

View File

@ -89,17 +89,13 @@ class InternalThread extends \Thread
return false;
}
$this->lock();
try {
return $this->synchronized(function () {
if ($this->lock) {
$this->lock = false;
return true;
}
return false;
} finally {
$this->unlock();
}
});
}
/**