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:
parent
3dce08de42
commit
c7dbf7394f
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user