Coroutine System API

Since version 4.4.6

Coroutine System provides a group of helper functions can be used within the coroutine context. These methods are not blocking the Linux process.

In the other word, the functions such as \sleep() provided by PHP should not be used within the coroutine context.

The functions: \fread, \fwrite, \fgets can be used within the coroutine context and not blocking the process.


  • Swoole\Coroutine\System::sleep
  • Swoole\Coroutine\System::exec
  • Swoole\Coroutine\System::gethostbyname
  • Swoole\Coroutine\System::getaddrinfo
  • Swoole\Coroutine\System::dnsLookup
  • Swoole\Coroutine\System::readFile
  • Swoole\Coroutine\System::writeFile
  • Swoole\Coroutine\System::statvfs
  • Swoole\Coroutine\System::waitEvent
  • Swoole\Coroutine\System::wait
  • Swoole\Coroutine\System::waitPid
  • Swoole\Coroutine\System::waitSignal

    Some methods are moved from namespace Swoole\Coroutine to namespace Swoole\Coroutine\System. The methods at namespace Swoole\Coroutine may be deprecated in the future.