No cache version.


Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

The EventBase class

(PECL event >= 1.2.6-beta)

Introduction

EventBase class represents libevent's event base structure. It holds a set of events and can poll to determine which events are active.

Each event base has a method , or a backend that it uses to determine which events are ready. The recognized methods are: select , poll , epoll , kqueue , devpoll , evport and win32 .

To configure event base to use, or avoid specific backend EventConfig class can be used.

Warning

Do NOT destroy the EventBase object as long as resources of the associated Event objects are not released. Otherwise, it will lead to unpredictable results!

PHP: EventBase - Manual Home of Manuel PHP  Contents Haut

Class synopsis

final EventBase {
/* Constants */
const integer LOOP_ONCE = 1 ;
const integer LOOP_NONBLOCK = 2 ;
const integer NOLOCK = 1 ;
const integer STARTUP_IOCP = 4 ;
const integer NO_CACHE_TIME = 8 ;
const integer EPOLL_USE_CHANGELIST = 16 ;
/* Methods */
public __construct ([ EventConfig $cfg ] )
public dispatch ( void ) : void
public exit ([ float $timeout ] ) : bool
public free ( void ) : void
public getFeatures ( void ) : int
public getMethod ( void ) : string
public getTimeOfDayCached ( void ) : float
public gotExit ( void ) : bool
public gotStop ( void ) : bool
public loop ([ int $flags ] ) : bool
public priorityInit ( int $n_priorities ) : bool
public reInit ( void ) : bool
public stop ( void ) : bool
}

PHP: EventBase - Manual Home of Manuel PHP  Contents Haut

Predefined Constants

EventBase::LOOP_ONCE

Flag used with EventBase::loop() method which means: "block until libevent has an active event, then exit once all active events have had their callbacks run".

EventBase::LOOP_NONBLOCK

Flag used with EventBase::loop() method which means: "do not block: see which events are ready now, run the callbacks of the highest-priority ones, then exit".

EventBase::NOLOCK

Configuration flag. Do not allocate a lock for the event base, even if we have locking set up".

EventBase::STARTUP_IOCP

Windows-only configuration flag. Enables the IOCP dispatcher at startup.

EventBase::NO_CACHE_TIME

Configuration flag. Instead of checking the current time every time the event loop is ready to run timeout callbacks, check after each timeout callback.

EventBase::EPOLL_USE_CHANGELIST

If we are using the epoll backend, this flag says that it is safe to use Libevent's internal change-list code to batch up adds and deletes in order to try to do as few syscalls as possible.

Setting this flag can make code run faster, but it may trigger a Linux bug: it is not safe to use this flag if one has any fds cloned by dup(), or its variants. Doing so will produce strange and hard-to-diagnose bugs.

This flag can also be activated by settnig the EVENT_EPOLL_USE_CHANGELIST environment variable.

This flag has no effect if one winds up using a backend other than epoll .

PHP: EventBase - Manual Home of Manuel PHP  Contents Haut

Table of Contents

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-class.eventbase.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut