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:
parent
f66cb4a66f
commit
665cc7fc5b
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user