/** * Creates the main event loop * * @param int $priorities The number of different priorities */ public function __construct($priorities = null) { $this->resource = event_base_new(); if (!is_null($priorities)) { event_base_priority_init($this->resource, $priorities); } }
/** * Sets the maximum priority level of the event base. * * @link http://www.php.net/manual/function.event-base-priority-init.php * @see event_base_priority_init * * @param int $priority * @throws EventException|\Exception * * @return EventBaseInterface */ public function setPriority($priority) { if (false === event_base_priority_init($this->resource, $priority)) { throw $this->exception('Could not set the maximum priority level of the event base (event_base_priority_init)'); } return $this; }