array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'swoole-coroutine-lock.lock.php', 1 => 'Swoole\\Coroutine\\Lock::lock', 2 => 'Acquire the lock, blocking if necessary', ), 'up' => array ( 0 => 'class.swoole-coroutine-lock.php', 1 => 'Swoole\\Coroutine\\Lock', ), 'prev' => array ( 0 => 'swoole-coroutine-lock.construct.php', 1 => 'Swoole\\Coroutine\\Lock::__construct', ), 'next' => array ( 0 => 'swoole-coroutine-lock.trylock.php', 1 => 'Swoole\\Coroutine\\Lock::trylock', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/swoole/swoole/coroutine/lock/lock.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Swoole\Coroutine\Lock::lock

(No version information available, might only be in Git)

Swoole\Coroutine\Lock::lockAcquire the lock, blocking if necessary

Опис

public Swoole\Coroutine\Lock::lock(): bool

When executing the lock operation, if the lock is already held by another coroutine, the current coroutine will actively yield CPU control and enter a suspended state. When the coroutine holding the lock calls unlock(), the waiting coroutine will be awakened and try to acquire the lock again.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns true if the lock was acquired successfully, false otherwise.