/** * Alias for Redshift::async(). * Schedules the $callback for asynchronous execution. * * @param callable $callback * @param mixed ...$args Arguments to be supplied to the $callback * at the time of execution. */ function async(callable $callback, ...$args) { Redshift::async($callback, ...$args); }
/** * Asynchronously removes a message from the channel. */ public function take() { Redshift::async(function ($channel) { (yield $channel->read()); }, $this); }
/** * Returns a channel on which a signal will be written after * the specified time. * * @param int $milliseconds * @return Channel */ public static function after($milliseconds) { $channel = new Channel(); Redshift::async(new Timeout($milliseconds, $channel)); return $channel; }