1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-13 09:37:26 +01:00
parallel/tests/Threading/ThreadTest.php

33 lines
662 B
PHP
Raw Normal View History

2015-08-28 23:58:15 +02:00
<?php
2015-08-31 20:30:07 +02:00
namespace Icicle\Tests\Concurrent\Threading;
2015-08-28 23:58:15 +02:00
use Icicle\Concurrent\Threading\Thread;
use Icicle\Coroutine;
use Icicle\Loop;
use Icicle\Tests\Concurrent\AbstractContextTest;
2015-08-28 23:58:15 +02:00
/**
* @group threading
* @requires extension pthreads
*/
class ThreadTest extends AbstractContextTest
2015-08-28 23:58:15 +02:00
{
public function createContext(callable $function)
2015-09-02 23:34:42 +02:00
{
return new Thread($function);
}
public function testSpawnStartsThread()
{
Coroutine\create(function () {
$thread = Thread::spawn(function () {
usleep(100);
});
yield $thread->join();
})->done();
Loop\run();
}
2015-08-28 23:58:15 +02:00
}