OpenSwoole\Event::dispatch

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\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 OpenSwoole control everything and not other processes.

Example

<?php
while(true) {
    OpenSwoole\Event::dispatch();
}
Last updated on September 1, 2022