You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
46
vendor/swoole/tests/swoole_atomic/wait.phpt
vendored
Executable file
46
vendor/swoole/tests/swoole_atomic/wait.phpt
vendored
Executable file
@ -0,0 +1,46 @@
|
||||
--TEST--
|
||||
swoole_atomic: wakeup & wait
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . '/../include/skipif.inc'; ?>
|
||||
--INI--
|
||||
assert.active=1
|
||||
assert.warning=1
|
||||
assert.bail=0
|
||||
assert.quiet_eval=0
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/bootstrap.php';
|
||||
|
||||
$atomic = new swoole_atomic;
|
||||
const N = 4;
|
||||
|
||||
$workers = [];
|
||||
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
{
|
||||
$p = new swoole_process(function () use ($atomic)
|
||||
{
|
||||
$atomic->wait();
|
||||
echo "Child OK\n";
|
||||
});
|
||||
$p->start();
|
||||
$workers[$i] = $p;
|
||||
}
|
||||
|
||||
usleep(200000);
|
||||
echo "Master OK\n";
|
||||
$atomic->wakeup(N);
|
||||
|
||||
for ($i = 0; $i < 4; $i++)
|
||||
{
|
||||
$status = swoole_process::wait();
|
||||
}
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
Master OK
|
||||
Child OK
|
||||
Child OK
|
||||
Child OK
|
||||
Child OK
|
Reference in New Issue
Block a user