1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-11 08:39:48 +01:00
parallel/test/Threading/ThreadTest.php
2017-03-21 23:19:15 -05:00

29 lines
585 B
PHP

<?php
namespace Amp\Parallel\Test\Threading;
use Amp\Loop;
use Amp\Parallel\Threading\Thread;
use Amp\Parallel\Test\AbstractContextTest;
/**
* @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();
});
}
}