Swoole\Event::wait

Declaration

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

Parameters

none

Return

void

Description

Waits for I/O events to complete. It calls epoll_wait and maintains the event loop and waits for it to fully complete before moving on, allowing you to wait for the tasks on the event loop to finish before continuing.

Example

<?php

Swoole\Timer::tick(1000, function () {
    echo "hello";
});

Swoole\Event::wait();

echo " world\n";