1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-04 10:38:30 +01:00
parallel/test/Threading/ThreadTest.php
2017-03-16 17:03:59 -05:00

29 lines
585 B
PHP

<?php
namespace Amp\Parallel\Test\Threading;
use Amp\Parallel\Threading\Thread;
use Amp\Parallel\Test\AbstractContextTest;
use Amp\Loop;
/**
* @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::spawn(function () {
usleep(100);
});
return yield $thread->join();
});
}
}