예제 #1
0
/**
 * 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);
}
예제 #2
0
 /**
  * Asynchronously removes a message from the channel.
  */
 public function take()
 {
     Redshift::async(function ($channel) {
         (yield $channel->read());
     }, $this);
 }
예제 #3
0
 /**
  * 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;
 }