mirror of
https://github.com/danog/parallel.git
synced 2024-12-02 17:52:14 +01:00
28 lines
607 B
PHP
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();
|
|
});
|
|
|
|
}
|
|
}
|