Is there a PHP extension (stability is irrelevant) that allows for direct epoll, kqueue, /dev/poll polling functions without going through libevent or libev extensions?
Inotify
You don't specify what 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 a another possible extension.
Here is an extensive, self-contained article showing how inotify works and how to use the C API.
Additionally, judging by by the conclusion of Robert Love's article: Intro to inotify, inotify has a very good performance:
inotify is a simple yet powerful file change notification system with an intuitive user interface, excellent performance, support for many different events and numerous features. inotify is currently in use in various projects, including Beagle, an advanced desktop indexing system, and Gamin, a FAM replacement.
Robert Love is a well respected Linux kernel hacker, and author of the reference book Linux Kernel Development (which I happen to own).
Right now libevent is going to be the most stable thing you can get for PHP. It supports epoll as a backend.
There is also an experimental extension for libev. It is less stable than the libevent one, but has a nicer OO API.
There is a PECL extension providing the classes Event
and EventBase
which can work with several things and also with epoll
.
See: http://www.php.net/manual/en/event.examples.php
Sorry I can't provide a sample other than you will find on the link because I didn't work with this yet.
EventBase class represents libevent's event base structure. It holds a set of events and can poll to determine which events are active.
Each event base has a method , or a backend that it uses to determine which events are ready. The recognized methods are: select , poll , epoll , kqueue , devpoll , evport and win32 .
To configure event base to use, or avoid specific backend EventConfig class can be used.
© 2022 - 2024 — McMap. All rights reserved.
stream_select()
andsocket_select()
already exist - what are you trying to do that can't be achieved using one of those two? – Arthurarthuriansocket_select()
does a system call toselect
. – Dusen