« Swoole\Coroutine\Lock::lock
Swoole\Coroutine\Lock::unlock »

Swoole\Coroutine\Lock::trylock

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

Swoole\Coroutine\Lock::trylock — Attempt to acquire the lock without blocking

説明

public function Swoole\Coroutine\Lock::trylock(): bool

When calling the lock operation, if the lock is already held by another coroutine, the function will immediately return false without suspending the current coroutine or yielding CPU control. This non-blocking design allows the caller to flexibly handle contention situations, such as retrying, giving up, or executing other logic.

パラメータ

この関数にはパラメータはありません。

戻り値

Returns true if the lock was acquired successfully, false if the lock is not available.

関連キーワード:
lock   Swoole   Coroutine   Lock   without   blocking   Attempt   acquire   trylock   available   coroutine   unlock   information   calling   operation   already   held   immediately   return   suspending   current   yielding   control   design   allows
関連する関数・ページ:
swoole-coroutine-lock.lock   swoole-coroutine-lock.construct   swoole-lock.lock   class.swoole-lock   swoole-coroutine-lock.unlock   swoole-lock.trylock