芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/vendor/amphp/sync/src/LocalSemaphore.php
locks = \range(0, $maxLocks - 1); } /** {@inheritdoc} */ public function acquire(): Promise { if (!empty($this->locks)) { return new Success(new Lock(\array_shift($this->locks), \Closure::fromCallable([$this, 'release']))); } $this->queue[] = $deferred = new Deferred; return $deferred->promise(); } private function release(Lock $lock): void { $id = $lock->getId(); if (!empty($this->queue)) { $deferred = \array_shift($this->queue); $deferred->resolve(new Lock($id, \Closure::fromCallable([$this, 'release']))); return; } $this->locks[] = $id; } }