the static property $cancel_list hold the value set in destruct in some case.
after barrier object destructed by set it's reference by null, we can unset this that value added in destruct
the following test case could trigger this issue
/**
* Test without execution switching between coroutines.
*
* @covers \Swoole\Coroutine\Barrier
*/
public function testNoCoroutineSwitching()
{
run(function () {
$barrier = Barrier::make();
$count = 0;
$N = 4;
foreach (range(1, $N) as $i) {
\Swoole\Coroutine::create(function () use ($barrier, &$count) {
$count++;
});
}
Barrier::wait($barrier);
$this->assertSame($N, $count, 'The parent coroutine keeps running without switching execution to child coroutines.');
});
}
the static property $cancel_list hold the value set in destruct in some case. after barrier object destructed by set it's reference by null, we can unset this that value added in destruct
the following test case could trigger this issue