Swoole\Event::dispatch

Declaration

<?php
Swoole\Event::dispatch()\:\ void

Parameters

none

Return

void

Description

Waits for I/O events only once. Compared with Event::wait, it calls epoll_wait only once, allowing the developer to control when to wait. The purpose of this function is to allow frameworks and low level libraries to maintain control of the event loop, as Event::wait only lets Swoole control everything and not other processes.

Example

<?php
while(true) {
    Swoole\Event::dispatch();
}