File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,6 @@ public function __construct()
9191 $ this ->queueCallback = $ this ->queue (...);
9292 $ this ->runCallback = function (): ?\Closure {
9393 do {
94- $ garbageCollected = false ;
9594 if ($ this ->fiber ->isTerminated ()) {
9695 $ this ->createLoopFiber ();
9796 }
@@ -100,11 +99,7 @@ public function __construct()
10099 if ($ result ) { // Null indicates the loop fiber terminated without suspending.
101100 return $ result ;
102101 }
103-
104- while (\gc_collect_cycles ()) {
105- $ garbageCollected = true ;
106- }
107- } while ($ garbageCollected && !$ this ->stopped );
102+ } while (!$ this ->stopped && \gc_collect_cycles ());
108103
109104 return null ;
110105 };
@@ -120,17 +115,14 @@ public function run(): void
120115 throw new \Error (\sprintf ("Can't call %s() within a fiber (i.e., outside of {main}) " , __METHOD__ ));
121116 }
122117
123- if ($ this ->fiber ->isTerminated ()) {
124- $ this ->createLoopFiber ();
125- }
126-
127- /** @noinspection PhpUnhandledExceptionInspection */
128- $ lambda = $ this ->fiber ->isStarted () ? $ this ->fiber ->resume () : $ this ->fiber ->start ();
118+ $ lambda = ($ this ->runCallback )();
129119
130120 if ($ lambda ) {
131121 $ lambda ();
132122
133- throw new \Error ('Interrupt from event loop must throw an exception: ' . ClosureHelper::getDescription ($ lambda ));
123+ throw new \Error (
124+ 'Interrupt from event loop must throw an exception: ' . ClosureHelper::getDescription ($ lambda )
125+ );
134126 }
135127 }
136128
You can’t perform that action at this time.
0 commit comments