|
The Swoole\Coroutine\Lock classはじめにSwoole 6.0.1 introduced a coroutine lock that supports inter-process and inter-thread sharing. This lock is designed with non-blocking behavior and enables efficient coroutine synchronization in multi-process and multi-thread environments.
When compiled with the
Without The coroutine lock is reentrant, allowing the currently holding coroutine to safely perform multiple lock operations. 警告
Do not create locks in callback functions like 警告
Locking and unlocking must be performed in the same coroutine, otherwise it will break static conditions. クラス概要Swoole\Coroutine\Lock
class Swoole\Coroutine\Lock
{
/* メソッド */
public void __construct()
public bool lock()
public bool trylock()
public bool unlock()
}例例1 Basic usage
|