©
本文档使用 PHP中文网手册 发布
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 either Event::__construct() , or Event::set() , or one of the factory methods like Event::timer() .
An event callback should match the following prototype:
$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:
$arg
= NULL
] )
arg
User custom data.
Event::signal() expects the callback to match the following prototype:
$signum
[, mixed $arg
= NULL
]] )
signum
The number of the triggered signal(e.g.
SIGTERM
).
arg
User custom data.
[#1] xilon dot jul at gmail dot com [2013-05-27 15:23:32]
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