The EvIo class

(PECL ev >= 0.2.0)

Einführung

EvIo watchers check whether a file descriptor(or socket, or a stream castable to numeric file descriptor) is readable or writable in each iteration of the event loop, or, more precisely, when reading would not block the process and writing would at least be able to write some data. This behaviour is called level-triggering because events are kept receiving as long as the condition persists. To stop receiving events just stop the watcher.

The number of read and/or write event watchers per fd is unlimited. Setting all file descriptors to non-blocking mode is also usually a good idea(but not required).

Another thing to watch out for is that it is quite easy to receive false readiness notifications, i.e. the callback might be called with Ev::READ but a subsequent read() will actually block because there is no data. It is very easy to get into this situation. Thus it is best to always use non-blocking I/O: An extra read() returning EAGAIN (or similar) is far preferable to a program hanging until some data arrives.

If for some reason it is impossible to run the fd in non-blocking mode, then separately re-test whether a file descriptor is really ready. Some people additionally use SIGALRM and an interval timer, just to be sure thry won't block infinitely.

Always consider using non-blocking mode.

Klassenbeschreibung

class EvIo extends EvWatcher {
/* Eigenschaften */
public $fd;
public $events;
/* Geerbte Eigenschaften */
public $is_active;
public $data;
public $is_pending;
public $priority;
/* Methoden */
public __construct(
     mixed $fd ,
     int $events ,
     callable $callback ,
     mixed $data = ?,
     int $priority = ?
)
final public static createStopped(
     mixed $fd ,
     int $events ,
     callable $callback ,
     mixed $data = null ,
     int $priority = 0
): EvIo
public set( mixed $fd , int $events ): void
/* Geerbte Methoden */
public EvWatcher::clear(): int
public EvWatcher::feed( int $revents ): void
public EvWatcher::invoke( int $revents ): void
public EvWatcher::keepalive( bool $value = ?): bool
public EvWatcher::setCallback( callable $callback ): void
public EvWatcher::start(): void
public EvWatcher::stop(): void
}

Eigenschaften

fd

events

Inhaltsverzeichnis

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

How to celebrate a birthday in Berlin in an unusual way?

How is it organized? Is the route fixed or can you choose your own? I wonder how long the whole trip takes and are there any restrictions? ​

Geschrieben von einermeiner am 31.03.2025 23:47:53
Forum: Apps und PHP Script Gesuche
How to celebrate a birthday in Berlin in an unusual way?

Riding around Berlin with friends, enjoying drinks and fun is a great idea for a holiday or just a nice day out. This format is great for companie ...

Geschrieben von daberty am 31.03.2025 23:46:24
Forum: Apps und PHP Script Gesuche
How to celebrate a birthday in Berlin in an unusual way?

This year I want to do something out of the ordinary, not just sit in a bar. I think to gather friends and make the holiday more active, perhaps w ...

Geschrieben von einermeiner am 31.03.2025 23:38:10
Forum: Apps und PHP Script Gesuche
Google reCAPTCHA in Kontaktformular einbinden

json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$captcha), true) eine gültige Antwor ...

Geschrieben von lauralorde am 31.03.2025 09:08:16
Forum: PHP Developer Forum