File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ final class Loop
17
17
private static $ driver = null ;
18
18
19
19
/**
20
- * @var bool
20
+ * @var int
21
21
*/
22
- private static $ running = false ;
22
+ private static $ level = 0 ;
23
23
24
24
/**
25
25
* Set the factory to be used to create a driver if none is passed to
@@ -30,7 +30,7 @@ public static function setFactory(LoopDriverFactory $factory = null)
30
30
{
31
31
self ::$ factory = $ factory ;
32
32
33
- if (! self ::$ running ) {
33
+ if (self ::$ level === 0 ) {
34
34
self ::$ driver = self ::createDriver ();
35
35
self ::$ registry = [];
36
36
}
@@ -53,7 +53,7 @@ public static function execute(callable $callback, LoopDriver $driver = null)
53
53
54
54
self ::$ driver = $ driver ;
55
55
self ::$ registry = [];
56
- self ::$ running = true ;
56
+ self ::$ level ++ ;
57
57
58
58
try {
59
59
$ callback ();
@@ -62,7 +62,7 @@ public static function execute(callable $callback, LoopDriver $driver = null)
62
62
} finally {
63
63
self ::$ driver = $ previousDriver ;
64
64
self ::$ registry = $ previousRegistry ;
65
- self ::$ running = false ;
65
+ self ::$ level -- ;
66
66
}
67
67
}
68
68
You can’t perform that action at this time.
0 commit comments