mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 15:11:53 +00:00
tests/pthreads_001: don't test pthread ext internals
This commit is contained in:
parent
059e0500fb
commit
97a9a2cc74
@ -12,28 +12,12 @@ if(!class_exists('Thread')) {
|
|||||||
|
|
||||||
class Workhorse extends Thread
|
class Workhorse extends Thread
|
||||||
{
|
{
|
||||||
protected $val;
|
|
||||||
|
|
||||||
public function __construct($val)
|
|
||||||
{
|
|
||||||
$this->val = $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$v8 = new V8Js();
|
$v8 = new V8Js();
|
||||||
$v8->val = $this->val;
|
if($v8->executeString('(11 + 12)') != 23) {
|
||||||
$v8->sync_var_dump = function($value) {
|
throw new \Exception('fail');
|
||||||
$this->synchronized(function($thread) use ($value) {
|
|
||||||
while(!$thread->readyToPrint) {
|
|
||||||
$thread->wait();
|
|
||||||
}
|
}
|
||||||
var_dump($value);
|
|
||||||
$thread->notify();
|
|
||||||
}, $this);
|
|
||||||
};
|
|
||||||
|
|
||||||
$v8->executeString('PHP.sync_var_dump(PHP.val);');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,23 +27,9 @@ $bar = new Workhorse('bar');
|
|||||||
$foo->start();
|
$foo->start();
|
||||||
$bar->start();
|
$bar->start();
|
||||||
|
|
||||||
$bar->synchronized(function($thread) {
|
|
||||||
$thread->readyToPrint = true;
|
|
||||||
$thread->notify();
|
|
||||||
$thread->wait();
|
|
||||||
}, $bar);
|
|
||||||
|
|
||||||
$foo->synchronized(function($thread) {
|
|
||||||
$thread->readyToPrint = true;
|
|
||||||
$thread->notify();
|
|
||||||
$thread->wait();
|
|
||||||
}, $foo);
|
|
||||||
|
|
||||||
$foo->join();
|
$foo->join();
|
||||||
$bar->join();
|
$bar->join();
|
||||||
?>
|
?>
|
||||||
===EOF===
|
===EOF===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(3) "bar"
|
|
||||||
string(3) "foo"
|
|
||||||
===EOF===
|
===EOF===
|
Loading…
Reference in New Issue
Block a user