1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-12 09:09:35 +01:00
parallel/test/Context/ThreadTest.php
Aaron Piotrowski 4d99a9d968
spawn → run
2017-12-10 17:01:10 -06:00

29 lines
589 B
PHP

<?php
namespace Amp\Parallel\Test\Context;
use Amp\Loop;
use Amp\Parallel\Context\Thread;
/**
* @group threading
* @requires extension pthreads
*/
class ThreadTest extends AbstractContextTest {
public function createContext(callable $function) {
return new Thread($function);
}
public function testSpawnStartsThread() {
Loop::run(function () {
$thread = Thread::run(function () {
usleep(100);
});
$this->assertTrue($thread->isRunning());
return yield $thread->join();
});
}
}