Interop\Async\Loop\Driver::run PHP Method

run() abstract public method

The loop MUST continue to run until it is either stopped explicitly, no referenced watchers exist anymore, or an exception is thrown that cannot be handled. Exceptions that cannot be handled are exceptions thrown from an error handler or exceptions that would be passed to an error handler but none exists to handle them.
abstract public run ( ) : void
return void
    public abstract function run();

Usage Example

Example #1
0
 /**
  * Execute a callback within the scope of an event loop driver.
  *
  * @param callable $callback The callback to execute.
  * @param Driver $driver The event loop driver. If `null`, a new one is created from the set factory.
  *
  * @return void
  *
  * @see \Interop\Async\Loop::setFactory()
  */
 public static function execute(callable $callback, Driver $driver = null)
 {
     $previousDriver = self::$driver;
     self::$driver = $driver ?: self::createDriver();
     self::$level++;
     try {
         self::$driver->defer($callback);
         self::$driver->run();
     } finally {
         self::$driver = $previousDriver;
         self::$level--;
     }
 }