EvEmbed::__construct

(PECL ev >= 0.2.0)

EvEmbed::__constructConstructs the EvEmbed object

Beschreibung

public EvEmbed::__construct(
     object $other ,
     callable $callback = ?,
     mixed $data = ?,
     int $priority = ?
)

This is a rather advanced watcher type that lets to embed one event loop into another(currently only IO events are supported in the embedded loop, other types of watchers might be handled in a delayed or incorrect fashion and must not be used).

See » the libev documentation for details.

This watcher is most useful on BSD systems without working kqueue to still be able to handle a large number of sockets. See example below.

Parameter-Liste

other

Instance of EvLoop . The loop to embed, this loop must be embeddable(see Ev::embeddableBackends() ).

callback

See Watcher callbacks .

data

Custom data associated with the watcher.

priority

Watcher priority

Beispiele

Beispiel #1 Embedding loop created with kqueue backend into the default loop

<?php
/*
 * Check if kqueue is available but not recommended and create a kqueue backend
 * for use with sockets (which usually work with any kqueue implementation).
 * Store the kqueue/socket-only event loop in loop_socket. (One might optionally
 * use EVFLAG_NOENV, too)
 *
 * Example borrowed from
 * http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9
 */
$loop        EvLoop::defaultLoop();
$socket_loop NULL;
$embed       NULL;

if (
Ev::supportedBackends() & ~Ev::recommendedBackends() & Ev::BACKEND_KQUEUE) {
    if ((
$socket_loop = new EvLoop(Ev::BACKEND_KQUEUE))) {
        
$embed = new EvEmbed($loop);
    }
}

if (!
$socket_loop) {
    
$socket_loop $loop;
}

// Now use $socket_loop for all sockets, and $loop for anything else
?>

Siehe auch

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

Welche Unterschiede gibt es zwischen Plinko und ähnlichen Spielen?

In diesem Forum vergleichen Spieler verschiedene Casinospiele hinsichtlich Mechanik, Spannung und Gewinnchancen. Erfahrungen, Meinungen und Analys ...

Geschrieben von rashelahmed am 03.01.2026 19:30:22
Forum: Off-Topic Diskussionen
Wie kann ich eine effiziente Batch-Verarbeitung in PHP mit PDO umsetzen?

For efficient batch processing with PDO, avoid OFFSET on large tables and instead batch by an indexed column (e.g. WHERE id > :lastId LIMIT 1000). ...

Geschrieben von smithjohns am 03.01.2026 09:09:17
Forum: PHP Developer Forum
Überhang in MySql Datenbank

Interesting MySQL issue! Seeing an 'Überhang' (overflow) record when your table is supposedly empty is definitely puzzling. First, try optimizing ...

Geschrieben von 6873marios am 02.01.2026 09:45:40
Forum: SQL / Datenbanken
SESSION werden nicht übergeben

Hmm, komisch, dann muss ich mal weiter forschen, denn rein logisch gesehen sollte das einwandfrei funktionieren. Danke trotzdem für deine Unterst ...

Geschrieben von I_am_Paul am 31.12.2025 14:28:03
Forum: PHP Developer Forum