pthreads_001.phpt 571 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Test V8::executeString() : Pthreads test #1
  3. --SKIPIF--
  4. <?php
  5. require_once(dirname(__FILE__) . '/skipif.inc');
  6. if(!class_exists('Thread')) {
  7. die('skip pthreads extension required');
  8. }
  9. ?>
  10. --FILE--
  11. <?php
  12. class Workhorse extends Thread
  13. {
  14. public function run()
  15. {
  16. $v8 = new V8Js();
  17. if($v8->executeString('(11 + 12)') != 23) {
  18. throw new \Exception('fail');
  19. }
  20. }
  21. }
  22. $foo = new Workhorse('foo');
  23. $bar = new Workhorse('bar');
  24. $foo->start();
  25. $bar->start();
  26. $foo->join();
  27. $bar->join();
  28. ?>
  29. ===EOF===
  30. --EXPECT--
  31. ===EOF===