Epoll, kqueue, / dev / poll .... extensions for PHP

Is there a PHP extension (stability does not matter) that allows you to use the direct epoll, kqueue, / dev / poll functions without going through the libevent or libev extensions?

+8
php events epoll
source share
3 answers

Inotify

You do not specify which architectures should be supported by the extension. But if Linux-only is an option, you can use inotify , which:

  • seems to have a more stable extension
  • provides similar functionality.

php-inotifytools is another possible extension.

Here's an extensive, standalone article showing how inotify works and how to use the C API.

Also, judging by the conclusion of an article by Robert Love: Intro to inotify , inotify has very good performance:

inotify is a simple but powerful file change notification system with an intuitive user interface, excellent performance, support for many different events and numerous functions. inotify is currently used in various projects, including Beagle, advanced system desktop indexing, and Gamin, a replacement for FAM.

Robert Love is a respected Linux kernel hacker and author of the Linux Kernel Development directory (which I have).

+2
source share

Libevent will be the most stable thing you can get for PHP right now. It supports epoll as a backend.

There is also an experimental extension for libev . It is less stable than libevent, but has a more convenient OO API.

0
source share

There is a PECL extension that provides Event and EventBase classes that can work with several things, as well as with epoll .

See: http://www.php.net/manual/en/event.examples.php

Sorry, I can’t provide a sample other than the one you will find in the link, because I have not worked with this yet.

The EventBase class represents the basic structure of the libevent event. It contains a set of events and can interrogate to determine which events are active.

Each event base has a method or backend that it uses to determine which events are ready. Recognized methods are: selection, polling, epoll, kqueue, devpoll, evport and win32.

To configure the event base to use, or to avoid the specific backend of the EventConfig class.

0
source share

All Articles