1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/test/Threading/ThreadTest.php
2016-08-21 23:40:48 -05:00

28 lines
607 B
PHP

<?php declare(strict_types = 1);
namespace Amp\Concurrent\Test\Threading;
use Amp\Concurrent\Threading\Thread;
use Amp\Concurrent\Test\AbstractContextTest;
/**
* @group threading
* @requires extension pthreads
*/
class ThreadTest extends AbstractContextTest {
public function createContext(callable $function) {
return new Thread($function);
}
public function testSpawnStartsThread() {
\Amp\execute(function () {
$thread = Thread::spawn(function () {
usleep(100);
});
return yield $thread->join();
});
}
}