Results of 1 - 1 of about 1 for waitGroup (0.000 sec.)
- The Swoole\Coroutine\Lock class | PHP 8.3 9414
- The Swoole\Coroutine\Lock class (No version information available, might only be in Git) はじめに Swoole 6.0.1 introduced a coroutine lock that supports inter-process and inter-thread sharing. This lock is designed with non-blocking behavio
... ylock (): bool public function unlock (): bool } 例 例1 Basic usage <?php use Swoole\Coroutine\Lock ; use Swoole\Coroutine\WaitGroup ; use function Swoole\Coroutine\go ; use function Swoole\Coroutine\run ; $lock = new Lock (); $waitGroup = new WaitGroup ( ... ); run (function() use ( $lock , $waitGroup ) { go (function() use ( $lock , $waitGroup ) { $waitGroup -> add (); $lock -> lock (); sleep ( 1 ); $lock -> unlock (); $ ... waitGroup -> done (); }); go (function() use ( $lock , $waitGroup ) { $waitGroup -> add (); $lock -> lock (); // Wait for the holding coroutine to unlock sleep ( 1 ); $lock -> unlock (); $ ...
-
https://man.mtool.work/php/8.3/class.swoole-coroutine-lock.html
PREV
1
NEXT