File tree Expand file tree Collapse file tree 1 file changed +4
-34
lines changed
Expand file tree Collapse file tree 1 file changed +4
-34
lines changed Original file line number Diff line number Diff line change @@ -12,28 +12,12 @@ if(!class_exists('Thread')) {
1212
1313class Workhorse extends Thread
1414{
15- protected $ val ;
16-
17- public function __construct ($ val )
18- {
19- $ this ->val = $ val ;
20- }
21-
2215 public function run ()
2316 {
2417 $ v8 = new V8Js ();
25- $ v8 ->val = $ this ->val ;
26- $ v8 ->sync_var_dump = function ($ value ) {
27- $ this ->synchronized (function ($ thread ) use ($ value ) {
28- while (!$ thread ->readyToPrint ) {
29- $ thread ->wait ();
30- }
31- var_dump ($ value );
32- $ thread ->notify ();
33- }, $ this );
34- };
35-
36- $ v8 ->executeString ('PHP.sync_var_dump(PHP.val); ' );
18+ if ($ v8 ->executeString ('(11 + 12) ' ) != 23 ) {
19+ throw new \Exception ('fail ' );
20+ }
3721 }
3822}
3923
@@ -43,23 +27,9 @@ $bar = new Workhorse('bar');
4327$ foo ->start ();
4428$ bar ->start ();
4529
46- $ bar ->synchronized (function ($ thread ) {
47- $ thread ->readyToPrint = true ;
48- $ thread ->notify ();
49- $ thread ->wait ();
50- }, $ bar );
51-
52- $ foo ->synchronized (function ($ thread ) {
53- $ thread ->readyToPrint = true ;
54- $ thread ->notify ();
55- $ thread ->wait ();
56- }, $ foo );
57-
5830$ foo ->join ();
5931$ bar ->join ();
6032?>
6133===EOF===
6234--EXPECT--
63- string(3) "bar"
64- string(3) "foo"
65- ===EOF===
35+ ===EOF===
You can’t perform that action at this time.
0 commit comments