final class EventBase (View source)

EventBase.

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.

Constants

LOOP_ONCE

LOOP_NONBLOCK

NOLOCK

STARTUP_IOCP

NO_CACHE_TIME

EPOLL_USE_CHANGELIST

IGNORE_ENV

PRECISE_TIMER

Methods

__construct(EventConfig|null $cfg = null)

__construct.

void
dispatch()

dispatch.

bool
exit(float $timeout = 0.0)

exit.

void
free()

free.

int
getFeatures()

getFeatures.

string
getMethod()

getMethod.

float
getTimeOfDayCached()

getTimeOfDayCached.

bool
gotExit()

gotExit.

bool
gotStop()

gotStop.

bool
loop(int $flags = -1)

loop.

bool
priorityInit(int $n_priorities)

priorityInit.

bool
reInit()

reInit.

bool
resume()

Tells event_base to resume previously stopped event

bool
stop()

stop.

bool
updateCacheTime()

Updates cache time

Details

__construct(EventConfig|null $cfg = null)

__construct.

Constructs EventBase object.

Parameters

EventConfig|null $cfg

Optional EventConfig object.

See also

https://php.net/manual/en/eventbase.construct.php

void dispatch()

dispatch.

Dispatch pending events.

bool exit(float $timeout = 0.0)

exit.

Stop dispatching events.

Parameters

float $timeout

Optional number of seconds after which the event base should stop dispatching events.

Return Value

bool

Returns true on success or false on failure.

See also

https://php.net/manual/en/eventbase.exit.php

void free()

free.

Free resources allocated for this event base.

int getFeatures()

getFeatures.

Returns bitmask of features supported.

Return Value

int

Returns integer representing a bitmask of supported features. See EventConfig::FEATURE_* constants.

See also

https://php.net/manual/en/eventbase.getfeatures.php

string getMethod()

getMethod.

Returns event method in use.

Return Value

string

String representing used event method(backend).

See also

https://php.net/manual/en/eventbase.getmethod.php

float getTimeOfDayCached()

getTimeOfDayCached.

Returns the current event base time.

Return Value

float

Returns the current event base time. On failure returns null.

See also

https://php.net/manual/en/eventbase.gettimeofdaycached.php

bool gotExit()

gotExit.

Checks if the event loop was told to exit.

Return Value

bool

Returns true, event loop was told to exit by EventBase::exit. Otherwise false.

See also

https://php.net/manual/en/eventbase.gotexit.php

bool gotStop()

gotStop.

Checks if the event loop was told to exit.

Return Value

bool

Returns true, event loop was told to stop by EventBase::stop. Otherwise false.

See also

https://php.net/manual/en/eventbase.gotstop.php

bool loop(int $flags = -1)

loop.

Dispatch pending events.

Parameters

int $flags

Optional flags. One of EventBase::LOOP_* constants. See EventBase constants.

Return Value

bool

Returns true on success or false on failure.

See also

https://php.net/manual/en/eventbase.loop.php

bool priorityInit(int $n_priorities)

priorityInit.

Sets number of priorities per event base.

Parameters

int $n_priorities

The number of priorities per event base.

Return Value

bool

Returns true on success or false on failure.

See also

https://php.net/manual/en/eventbase.priorityinit.php

bool reInit()

reInit.

Re]initialize event base(after a fork).

Return Value

bool

Returns true on success or false on failure.

See also

https://php.net/manual/en/eventbase.reinit.php

bool resume()

Tells event_base to resume previously stopped event

Return Value

bool

bool stop()

stop.

Tells event_base to stop dispatching events.

Return Value

bool

Returns true on success or false on failure.

See also

https://php.net/manual/en/eventbase.stop.php

bool updateCacheTime()

Updates cache time

Return Value

bool