Create and initialize new event base
* *Returns new event base, which can be used later in {@link event_base_set}(), {@link event_base_loop}() and other functions.
* * @link https://php.net/event_base_new * * @return resource|false returns valid event base resource on success or FALSE on error. */ function event_base_new() {} /** *Destroy event base
*(PECL libevent >= 0.0.1)
* *Destroys the specified event_base and frees all the resources associated. * Note that it's not possible to destroy an event base with events attached to it.
* * @link https://php.net/event_base_free * * @param resource $event_base Valid event base resource. * * @return void */ function event_base_free($event_base) {} /** *Handle events
*(PECL libevent >= 0.0.1)
* *Starts event loop for the specified event base.
* *By default, the {@link event_base_loop}() function runs an event_base until * there are no more events registered in it. To run the loop, it repeatedly * checks whether any of the registered events has triggered (for example, * if a read event's file descriptor is ready to read, or if a timeout event's * timeout is ready to expire). Once this happens, it marks all triggered events * as "active", and starts to run them. *
* *You can change the behavior of event_base_loop() by setting one or more flags * in its flags argument. If EVLOOP_ONCE is set, then the loop will wait until some * events become active, then run active events until there are no more to run, then * return. If EVLOOP_NONBLOCK is set, then the loop will not wait for events to trigger: * it will only check whether any events are ready to trigger immediately, * and run their callbacks if so. *
* * @link https://php.net/event_base_loop * * @param resource $event_base Valid event base resource. * @param int $flags [optional] Optional parameter, which can take any combination of EVLOOP_ONCE and EVLOOP_NONBLOCK. * * @return int* Returns 0 if it exited normally, * -1 if it exited because of some unhandled error in the backend * and 1 if no events were registered. *
*/ function event_base_loop($event_base, $flags = null) {} /** *Tells the event_base to exit its loop immediately.
*(PECL libevent >= 0.0.1)
* *It differs from {@link event_base_loopexit}() in that if the event_base is currently * running callbacks for any active events, it will exit immediately after finishing the * one it's currently processing. The behaviour is similar to break statement.
* * @link https://php.net/event_base_loopbreak * * @param resource $event_base Valid event base resource. * * @return bool returns TRUE on success or FALSE on error. */ function event_base_loopbreak($event_base) {} /** *Tells an event_base to stop looping after a given time has elapsed
*(PECL libevent >= 0.0.1)
* *If the event_base is currently running callbacks for any active events, * it will continue running them, and not exit until they have all been run.
* *If event loop isn't running {@link event_base_loopexit}() schedules the next instance * of the event loop to stop right after the next round of callbacks are run (as if it had * been invoked with EVLOOP_ONCE).
* * @link https://php.net/event_base_loopexit * * @param resource $event_base* Valid event base resource. *
* @param int $timeout [optional]* Optional timeout parameter (in microseconds). If lower than 1, * the event_base stops looping without a delay. *
* * @return bool returns TRUE on success or FALSE on error. */ function event_base_loopexit($event_base, $timeout = -1) {} /** *Associate event base with an event
*(PECL libevent >= 0.0.1)
* *Associates the event_base with the event.
* * @link https://php.net/event_base_set * * @param resource $event Valid event resource. * @param resource $base Valid event base resource. * * @return bool returns TRUE on success or FALSE on error. */ function event_base_set($event, $base) {} /** *Set the number of different event priority levels
*(PECL libevent >= 0.0.2)
* *By default all events are scheduled with the same priority (npriorities/2). * Using {@link event_base_priority_init}() you can change the number of event priority * levels and then set a desired priority for each event.
* * @link https://php.net/event_base_priority_init * * @param resource $event_base Valid event base resource. * @param int $npriorities The number of event priority levels. * * @return bool returns TRUE on success or FALSE on error. */ function event_base_priority_init($event_base, $npriorities) {} /** *Creates and returns a new event resource.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_new * * @return resource|false returns a new event resource on success or FALSE on error. */ function event_new() {} /** *Free event resource.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_free * * @param resource $event Valid event resource. * * @return void */ function event_free($event) {} /** *Add an event to the set of monitored events
*(PECL libevent >= 0.0.1)
* *Schedules the execution of the non-pending event (makes it pending in it's * configured base) when the event specified in {@link event_set}() occurs or in * at least the time specified by the timeout argument. If timeout was not specified, * not timeout is set. The event must be already initialized by * {@link event_set}() and {@link event_base_set}() functions. * If the event already has a timeout set, * it is replaced by the new one.
* *If you call {@link event_add}() on an event that is already pending, * it will leave it pending, and reschedule it with the provided timeout.
* * @link https://php.net/event_add * * @param resource $event* Valid event resource. *
* @param int $timeout [optional]* Optional timeout (in microseconds). *
* * @return bool returns TRUE on success or FALSE on error. */ function event_add($event, $timeout = -1) {} /** *Prepares the event to be used in {@link event_add}().
*(PECL libevent >= 0.0.1)
* *The event is prepared to call the function specified by the callback * on the events specified in parameter events, which is a set of the following * flags: EV_TIMEOUT, EV_SIGNAL, EV_READ, EV_WRITE and EV_PERSIST.
* *EV_SIGNAL support was added in version 0.0.4
* *After initializing the event, use {@link event_base_set}() to associate the event with its event base.
* *In case of matching event, these three arguments are passed to the callback function: *
$fd | *Signal number or resource indicating the stream. | *
$events | *A flag indicating the event. Consists of the following flags: EV_TIMEOUT, EV_SIGNAL, EV_READ, EV_WRITE and EV_PERSIST. | *
$arg | *Optional parameter, previously passed to {@link event_set}() as arg. | *
* Valid event resource. *
* @param resource|int $fd* Valid PHP stream resource. The stream must be castable to file descriptor, * so you most likely won't be able to use any of filtered streams. *
* @param int $events* A set of flags indicating the desired event, can be EV_READ and/or EV_WRITE. * The additional flag EV_PERSIST makes the event to persist until {@link event_del}() is * called, otherwise the callback is invoked only once. *
* @param callable $callback* Callback function to be called when the matching event occurs. *
* @param mixed $arg [optional]* Optional callback parameter. *
* * @return bool returns TRUE on success or FALSE on error. */ function event_set($event, $fd, $events, $callback, $arg = null) {} /** *Remove an event from the set of monitored events.
*(PECL libevent >= 0.0.1)
* *Calling {@link event_del}() on an initialized event makes it non-pending * and non-active. If the event was not pending or active, there is no effect.
* * @link https://php.net/event_del * * @param resource $event Valid event resource. * * @return bool returns TRUE on success or FALSE on error. */ function event_del($event) {} /** *Create new buffered event
*(PECL libevent >= 0.0.1)
* *Libevent provides an abstraction layer on top of the regular event API. * Using buffered event you don't need to deal with the I/O manually, instead * it provides input and output buffers that get filled and drained automatically.
* *Every bufferevent has two data-related callbacks: a read callback and a write * callback. By default, the read callback is called whenever any data is read from * the underlying transport, and the write callback is called whenever enough data * from the output buffer is emptied to the underlying transport. You can override * the behavior of these functions by adjusting the read and write "watermarks" * of the bufferevent (see {@link event_buffer_watermark_set}()).
* *A bufferevent also has an "error" or "event" callback that gets invoked to tell * the application about non-data-oriented events, like when a connection is closed or * an error occurs.
* * @link https://php.net/event_buffer_new * * @param resource $stream Valid PHP stream resource. Must be castable to file descriptor. * @param callable|null $readcb Callback to invoke where there is data to read, or NULL if no callback is desired. * @param callable|null $writecb Callback to invoke where the descriptor is ready for writing, or NULL if no callback is desired. * @param callable $errorcb Callback to invoke where there is an error on the descriptor, cannot be NULL. * @param mixed $arg An argument that will be passed to each of the callbacks (optional). * * @return resource|false returns new buffered event resource on success or FALSE on error. */ function event_buffer_new($stream, $readcb, $writecb, $errorcb, $arg = null) {} /** *Destroys the specified buffered event and frees all the resources associated.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_buffer_free * * @param resource $bevent Valid buffered event resource. * * @return void */ function event_buffer_free($bevent) {} /** *Associate buffered event with an event base
*(PECL libevent >= 0.0.1)
* *Assign the specified bevent to the event_base.
* * @link https://php.net/event_buffer_base_set * * @param resource $bevent Valid buffered event resource. * @param resource $event_base Valid event base resource. * * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_base_set($bevent, $event_base) {} /** *Assign a priority to a buffered event. Use it after * initializing event, but before adding an event to the event_base.
*(PECL libevent >= 0.0.1)
* *When multiple events trigger at the same time, Libevent * does not define any order with respect to when their callbacks * will be executed. You can define some events as more important * than others by using priorities.
* *When multiple events of multiple priorities become active, * the low-priority events are not run. Instead, Libevent runs * the high priority events, then checks for events again. Only * when no high-priority events are active are the low-priority * events run.
* *When you do not set the priority for an event, the default * is the number of queues in the event base, divided by 2.
* * @link https://php.net/event_buffer_priority_set * * @see event_base_priority_init * * @param resource $bevent* Valid buffered event resource. *
* @param int $priority* Priority level. Cannot be less than 0 and cannot exceed * maximum priority level of the event base (see {@link event_base_priority_init}()). *
* * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_priority_set($bevent, $priority) {} /** *Writes data to the specified buffered event.
*(PECL libevent >= 0.0.1)
* *The data is appended to the output buffer and written * to the descriptor when it becomes available for writing.
* * @link https://php.net/event_buffer_write * * @param resource $bevent Valid buffered event resource. * @param string $data The data to be written. * @param int $data_size Optional size parameter. {@link event_buffer_write}() writes all the data by default * * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_write($bevent, $data, $data_size = -1) {} /** *Reads data from the input buffer of the buffered event.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_buffer_read * * @param resource $bevent Valid buffered event resource. * @param int $data_size Data size in bytes. * * @return string */ function event_buffer_read($bevent, $data_size) {} /** *Enables the specified buffered event.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_buffer_enable * * @param resource $bevent Valid buffered event resource. * @param int $events Any combination of EV_READ and EV_WRITE. * * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_enable($bevent, $events) {} /** *Disable a buffered event
*(PECL libevent >= 0.0.1)
* *Disables the specified buffered event.
* * @link https://php.net/event_buffer_disable * * @param resource $bevent Valid buffered event resource. * @param int $events Any combination of EV_READ and EV_WRITE. * * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_disable($bevent, $events) {} /** *Sets the read and write timeouts for the specified buffered event.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_buffer_timeout_set * * @param resource $bevent Valid buffered event resource. * @param int $read_timeout Read timeout (in seconds). * @param int $write_timeout Write timeout (in seconds). * * @return void */ function event_buffer_timeout_set($bevent, $read_timeout, $write_timeout) {} /** *Set the watermarks for read and write events.
*(PECL libevent >= 0.0.1)
* *Every bufferevent has four watermarks:
* *Read low-water mark
* Whenever a read occurs that leaves the bufferevent's input buffer at this
* level or higher, the bufferevent's read callback is invoked. Defaults to 0,
* so that every read results in the read callback being invoked.
Read high-water mark
* If the bufferevent's input buffer ever gets to this level, the bufferevent
* stops reading until enough data is drained from the input buffer to take us
* below it again. Defaults to unlimited, so that we never stop reading because
* of the size of the input buffer.
Write low-water mark
* Whenever a write occurs that takes us to this level or below, we invoke the write
* callback. Defaults to 0, so that a write callback is not invoked unless the output
* buffer is emptied.
Write high-water mark
* Not used by a bufferevent directly, this watermark can have special meaning when
* a bufferevent is used as the underlying transport of another bufferevent.
Libevent does not invoke read callback unless there is at least lowmark * bytes in the input buffer; if the read buffer is beyond the highmark, * reading is stopped. On output, the write callback is invoked whenever * the buffered data falls below the lowmark.
* * @link https://php.net/event_buffer_watermark_set * * @param resource $bevent Valid buffered event resource. * @param int $events Any combination of EV_READ and EV_WRITE. * @param int $lowmark Low watermark. * @param int $highmark High watermark. * * @return void */ function event_buffer_watermark_set($bevent, $events, $lowmark, $highmark) {} /** *Changes the file descriptor on which the buffered event operates.
*(PECL libevent >= 0.0.1)
* * @link https://php.net/event_buffer_fd_set * * @param resource $bevent Valid buffered event resource. * @param resource $fd Valid PHP stream, must be castable to file descriptor. * * @return void */ function event_buffer_fd_set($bevent, $fd) {} /** *Set or reset callbacks for a buffered event
*(PECL libevent >= 0.0.4)
* *Sets or changes existing callbacks for the buffered event.
* * @link https://php.net/event_buffer_set_callback * * @param resource $bevent Valid buffered event resource. * @param callable|null $readcb Callback to invoke where there is data to read, or NULL if no callback is desired. * @param callable|null $writecb Callback to invoke where the descriptor is ready for writing, or NULL if no callback is desired. * @param callable $errorcb Callback to invoke where there is an error on the descriptor, cannot be NULL. * @param mixed $arg An argument that will be passed to each of the callbacks (optional). * * @return bool returns TRUE on success or FALSE on error. */ function event_buffer_set_callback($bevent, $readcb, $writecb, $errorcb, $arg = null) {} /** *Alias of {@link event_new}().
* * @return resource|false returns valid event base resource on success or FALSE on error. */ function event_timer_new() {} /** *Prepares the timer event to be used in {@link event_add}().
* *The event is prepared to call the function specified by the callback * on the timeout event (EV_TIMEOUT).
* *After initializing the event, use {@link event_base_set}() to associate the event with its event base.
* *In case of matching event, these three arguments are passed to the callback function: *
$fd | *null | *
$events | *A flag indicating the event. EV_TIMEOUT. | *
$arg | *Optional parameter, previously passed to {@link event_timer_set}() as arg. | *
* Valid event resource. *
* @param callable $callback* Callback function to be called when the matching event occurs. *
* @param mixed $arg [optional]* Optional callback parameter. *
* * @return void */ function event_timer_set($event, $callback, $arg = null) {} /** *Checks if a specific event is pending or scheduled.
* * @param resource $event* Valid event resource. *
* @param int $timeout [optional]* Optional timeout (in microseconds). *
* * @return bool TRUE if event is not scheduled (added) FALSE otherwise */ function event_timer_pending($event, $timeout = -1) {} /** *Alias of {@link event_add}().
* * @param resource $event* Valid event resource. *
* @param int $timeout [optional]* Optional timeout (in microseconds). *
* * @return bool returns TRUE on success or FALSE on error. */ function event_timer_add($event, $timeout = -1) {} /** *Alias of {@link event_del}().
* * @param resource $event Valid event resource. * * @return bool returns TRUE on success or FALSE on error. */ function event_timer_del($event) {} // End of PECL libevent v.0.0.4