1
0
mirror of https://github.com/danog/amp.git synced 2024-12-03 18:07:57 +01:00

Instantiate driver if none exists upon Loop::setFactory to support sync waits

This commit is contained in:
Niklas Keller 2016-05-18 13:20:41 +02:00
parent f66cb4a66f
commit 665cc7fc5b

View File

@ -18,10 +18,12 @@ final class Loop
/**
* Set the factory to be used to create a driver if none is passed to
* self::execute.
* self::execute. A default driver will be created if none exists yet
* to support synchronous waits in traditional applications.
*/
public static function setFactory(LoopDriverFactory $factory = null) {
self::$factory = $factory;
self::$driver = self::$driver ?: self::createDriver();
}
/**