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 either Event::__construct() , or Event::set() , or one of the factory methods like Event::timer() .
An event callback should match the following prototype:
-
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
-
User custom data.
Event::signal() expects the callback to match the following prototype:
-
signum
-
The number of the triggered signal(e.g.
SIGTERM
). -
arg
-
User custom data.
- Введение
- Установка и настройка
- Примеры
- Event flags
- About event persistence
- Event callbacks
- Constructing signal events
- The Event class
- The EventBase class
- The EventBuffer class
- The EventBufferEvent class
- About buffer event callbacks
- The EventConfig class
- The EventDnsBase class
- The EventHttp class
- The EventHttpConnection class
- The EventHttpRequest class
- The EventListener class
- The EventSslContext class
- The EventUtil class
Коментарии
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