Skip to content

Commit 665cc7f

Browse files
committed
Instantiate driver if none exists upon Loop::setFactory to support sync waits
1 parent f66cb4a commit 665cc7f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Loop.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ final class Loop
1818

1919
/**
2020
* Set the factory to be used to create a driver if none is passed to
21-
* self::execute.
21+
* self::execute. A default driver will be created if none exists yet
22+
* to support synchronous waits in traditional applications.
2223
*/
2324
public static function setFactory(LoopDriverFactory $factory = null) {
2425
self::$factory = $factory;
26+
self::$driver = self::$driver ?: self::createDriver();
2527
}
2628

2729
/**

0 commit comments

Comments
 (0)