Event Loop API

Event Loop is the low level Event Loop API such as epoll_wait. All the Async I/O fds are managed by the Event Loop. The Event Loop is waiting for the readable, writeable, timeout of all the fds. When an event (or timeout) occurs, the epoll_wait function finished and return the result. You then can execute the callback function to process the data sending from the Event Loop.

When a large amount of fds is registed on the Event Loop, and a large number of events are generated at the same time, the corresponding callback functions are executed one by one.

You can use Event Loop API to add event callback function onto the main Event Loop in the process. These are the API to make changes to low level epoll/kqueue.

Before using these API, you have to understand how non-blocking I/O, I/O multiplexing and Event Loop works.

Only non-blocking I/O fd should be added into the event loop. Blocking IO should not be added into the Event Loop.

It can be used to manage socket created with stream/socket APi with the Event Loop.

It is not recommned to use directly within your application.

Methods

  • Swoole\Event->set
  • Swoole\Event->add
  • Swoole\Event->del
  • Swoole\Event->exit
  • Swoole\Event->wait
  • Swoole\Event->write
  • Swoole\Event->defer
  • Swoole\Event->dispatch
  • Swoole\Event->cycle
  • Swoole\Event->isset