dismiss Step into the future! Click here to switch to the beta php.net site
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Constructing signal events> <About event persistence
[edit] Last updated: Fri, 28 Jun 2013

view this page in

Event callbacks

If a callback is registered for an event, it will be called when the event becomes active. To associate a callback with event one can pass a callable to whether Event::__construct() , or Event::set() , or one of the factory methods like Event::timer() .

An event callback should match the following prototype:

void callback ([ mixed $fd = NULL [, int $what [, mixed $arg = NULL ]]] )

fd

The file descriptor, stream resource or socket associated with the event. For signal event fd is equal to the signal number.

what

Bit mask of all events triggered.

arg

User custom data.

Event::timer() expects the callback to match the following prototype:

void callback ([ mixed $arg = NULL ] )

arg

User custom data.

Event::signal() expects the callback to match the following prototype:

void callback ([ int $signum [, mixed $arg = NULL ]] )

signum

The number of the triggered signal(e.g. SIGTERM ).

arg

User custom data.



add a note add a note User Contributed Notes Event callbacks - [1 notes]
up
0
xilon dot jul at gmail dot com
1 month ago
For event timers, the callback prototype is equivalent to sockets related callback. User arguments are given as the third parameter.

This has been tested under : Event version 1.6.1

 
show source | credits | stats | sitemap | contact | advertising | mirror sites