final class Event (View source)

Event.

Event class represents and event firing on a file descriptor being ready to read from or write to; a file descriptor becoming ready to read from or write to(edge-triggered I/O only); a timeout expiring; a signal occurring; a user-triggered event. Every event is associated with EventBase . However, event will never fire until it is added (via Event::add() ). An added event remains in pending state until the registered event occurs, thus turning it to active state. To handle events user may register a callback which is called when event becomes active. If event is configured persistent , it remains pending. If it is not persistent, it stops being pending when it's callback runs. Event::del() method deletes event, thus making it non-pending. By means of Event::add() method it could be added again.

Constants

ET

PERSIST

READ

WRITE

SIGNAL

TIMEOUT

Properties

bool $pending

Methods

__construct(EventBase $base, mixed $fd, int $what, callable $cb, mixed $arg = null)

__construct.

bool
add(float $timeout = -1)

add.

bool
addSignal(float $timeout = -1)

addSignal.

bool
addTimer(float $timeout = -1)

addTimer.

bool
del()

del.

bool
delSignal()

delSignal.

bool
delTimer()

delTimer.

void
free()

free.

static array
getSupportedMethods()

getSupportedMethods.

bool
pending(int $flags)

pending.

bool
set(EventBase $base, mixed $fd, int $what, callable $cb, mixed $arg)

set.

bool
setPriority(int $priority)

setPriority.

bool
setTimer(EventBase $base, callable $cb, mixed $arg)

setTimer.

static Event
signal(EventBase $base, int $signum, callable $cb, mixed $arg)

signal.

static Event
timer(EventBase $base, callable $cb, mixed $arg)

timer.

Details

__construct(EventBase $base, mixed $fd, int $what, callable $cb, mixed $arg = null)

__construct.

Constructs Event object.

Parameters

EventBase $base
mixed $fd
int $what
callable $cb
mixed $arg

= null

See also

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

bool add(float $timeout = -1)

add.

Makes event pending.

Parameters

float $timeout (optional)

Return Value

bool

See also

https://php.net/manual/en/event.add.php

bool addSignal(float $timeout = -1)

addSignal.

Makes signal event pending.

Parameters

float $timeout (optional)

Return Value

bool

See also

https://php.net/manual/en/event.addsignal.php

bool addTimer(float $timeout = -1)

addTimer.

Makes timer event pending.

Parameters

float $timeout (optional)

Return Value

bool

See also

https://php.net/manual/en/event.addtimer.php

bool del()

del.

Makes event non-pending.

Return Value

bool

See also

https://php.net/manual/en/event.del.php

bool delSignal()

delSignal.

Makes signal event non-pending.

bool delTimer()

delTimer.

Makes timer event non-pending.

void free()

free.

Make event non-pending and free resources allocated for this event.

Return Value

void

See also

https://php.net/manual/en/event.free.php

static array getSupportedMethods()

getSupportedMethods.

Returns array with of the names of the methods supported in this version of Libevent.

bool pending(int $flags)

pending.

Detects whether event is pending or scheduled.

Parameters

int $flags

Return Value

bool

See also

https://php.net/manual/en/event.pending.php

bool set(EventBase $base, mixed $fd, int $what, callable $cb, mixed $arg)

set.

Re-configures event.

Parameters

EventBase $base
mixed $fd
int $what (optional)
callable $cb (optional)
mixed $arg (optional)

Return Value

bool

See also

https://php.net/manual/en/event.set.php

bool setPriority(int $priority)

setPriority.

Set event priority.

Parameters

int $priority

Return Value

bool

See also

https://php.net/manual/en/event.setpriority.php

bool setTimer(EventBase $base, callable $cb, mixed $arg)

setTimer.

Re-configures timer event.

Parameters

EventBase $base
callable $cb
mixed $arg (optional)

Return Value

bool

See also

https://php.net/manual/en/event.settimer.php

static Event signal(EventBase $base, int $signum, callable $cb, mixed $arg)

signal.

Constructs signal event object.

Parameters

EventBase $base
int $signum
callable $cb
mixed $arg (optional)

Return Value

Event

See also

https://php.net/manual/en/event.signal.php

static Event timer(EventBase $base, callable $cb, mixed $arg)

timer.

Constructs timer event object.

Parameters

EventBase $base
callable $cb
mixed $arg (optional)

Return Value

Event

See also

https://php.net/manual/en/event.timer.php