1
0
mirror of https://github.com/danog/parallel.git synced 2025-01-09 22:28:26 +01:00
parallel/test/Context/ThreadTest.php
Aaron Piotrowski cb5ea736d4
Improve process IPC
Processes now use a shared server socket instead of stdin and stdout for IPC.
2018-10-07 09:31:35 -05:00

29 lines
595 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 = yield Thread::run(function () {
usleep(100);
});
$this->assertTrue($thread->isRunning());
return yield $thread->join();
});
}
}