1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-04 10:38:30 +01:00
parallel/test/Threading/ThreadTest.php
2016-08-18 17:36:58 -05:00

28 lines
580 B
PHP

<?php
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();
});
}
}