I'm trying to use the extension php_pthreads with Symfony2. I set up a simple controller:
<?php
namespace Test\TestBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class SimpleThread extends \Thread {
public function run() {
sleep(100);
}
}
class DefaultController extends Controller
{
public function indexAction()
{
$simpleThread = new SimpleThread();
$simpleThread->start();
return $this->render('TestTestBundle:Default:index.html.twig', array('name' => "World"));
}
}
And it just gives me a blank page (ERR_CONNECTION_RESET). I have nothing to try to fix it since there is no error, I don't know how to debug this.
When I try to run this simple test code (https://stackoverflow.com/a/15501449/3070307) outside of Symfony, it works fine.
Any help is much appreciated.
EDIT: Ok two things:
sleep(100);
Sleeps for 100 seconds... I miss-typed usleep.
Second, the Symfony cache is messing with thread execution apprently, disabling it fixed it (http://symfony.com/doc/current/cookbook/debugging.html).
The only remaining problem is the render function does nothing, I'm not even sure it's called.