Event::timer
EventBase::__construct
Event
PHP Manual

# The EventBase class

(PECL event >= 1.2.6-beta)

## 導入

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.

警告

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!

## クラス概要

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 ;
/* メソッド */
public __construct ([ EventConfig `$cfg` ] )
public void dispatch ( void )
public void exit ([ double `$timeout` ] )
public int getFeatures ( void )
public string getMethod ([ EventConfig `$cfg` ] )
public double getTimeOfDayCached ( void )
public void gotExit ( void )
public void gotStop ( void )
public bool loop ([ int `$flags` ] )
public bool priorityInit ( string `$n_priorities` )
public void reInit ( string `$base` )
public bool stop ( void )
}

## 定義済み定数

`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 .

## 目次

- EventBase::__construct — Constructs EventBase object
- EventBase::dispatch — Dispatch pending events
- EventBase::exit — Stop dispatching events
- EventBase::getFeatures — Returns bitmask of features supported
- EventBase::getMethod — Returns event method in use
- EventBase::getTimeOfDayCached — Returns the current event base time
- EventBase::gotExit — Checks if the event loop was told to exit
- EventBase::gotStop — Checks if the event loop was told to exit
- EventBase::loop — Dispatch pending events
- EventBase::priorityInit — Sets number of priorities per event base
- EventBase::reInit — Re-initialize event base(after a fork).
- EventBase::stop — Tells event_base to stop dispatching events

Event::timer
EventBase::__construct
Event
PHP Manual