eio_grp_add

(PECL eio >= 0.0.1dev)

eio_grp_addAdds a request to the request group

Beschreibung

eio_grp_add(resource $grp, resource $req): void

eio_grp_add() adds a request to the request group.

Parameter-Liste

grp

The request group resource returned by eio_grp()

req

The request resource

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 Grouping requests

<?php
/*
 * Create a group request to open, read and close a file
 */

// Create temporary file and write some bytes to it
$temp_filename dirname(__FILE__) ."/eio-file.tmp";
$fp fopen($temp_filename"w");
fwrite($fp"some data");
fclose($fp);

/* Is called when the group requests are done */
function my_grp_done($data$result) {
 
var_dump($result == 0);
 @
unlink($data);
}

/* Is called when eio_open() done */
function my_grp_file_opened_callback($data$result) {
 global 
$grp;

 
// $result should contain the file descriptor
 
var_dump($result 0);

 
// Create eio_read() request and add it to the group
 // Pass file descriptor to the callback
 
$req eio_read($result40,
   
EIO_PRI_DEFAULT"my_grp_file_read_callback"$result);
 
eio_grp_add($grp$req);
}

/* Is called when eio_read() done */
function my_grp_file_read_callback($data$result) {
 global 
$grp;

 
// Read bytes
 
var_dump($result);

 
// Create eio_close() request and add it to the group
 // $data should contain the file descriptor
 
$req eio_close($data);
 
eio_grp_add($grp$req);
}

// Create request group
$grp eio_grp("my_grp_done"$temp_filename);
var_dump($grp);

// Create eio_open() request and add it to the group
$req eio_open($temp_filenameEIO_O_RDWR EIO_O_APPEND NULL,
  
EIO_PRI_DEFAULT"my_grp_file_opened_callback"NULL);
eio_grp_add($grp$req);

// Process requests
eio_event_loop();
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

resource(6) of type (EIO Group Descriptor)
bool(true)
string(4) "some"
bool(true)

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

Diablo 4 Season 12 Items Massacre Sale! Rush to D4Gold.com!

Diablo IV Season 12: Season of Slaughter is in full swing, and every player in Sanctuary is racing to stay ahead of the meta, unlock high-end gear ...

Geschrieben von salisy am 18.04.2026 04:34:44
Forum: User stellen sich vor
Where to buy The Best POE Patch 3.28 & POE 2 Currency?

POE 3.28 Mirage Leaguehas been live for quite some time, and the community’s focus is no longer on new updates—instead, players are talking mo ...

Geschrieben von salisy am 18.04.2026 04:25:14
Forum: User stellen sich vor
Where to buy Monopoly Go Stickers? Answer is EZG.com!

The brand new album Monopoly Ever After Album has been released, bringing a new album and a new experience, with all sorts of novel and exquisite ...

Geschrieben von salisy am 18.04.2026 04:17:06
Forum: User stellen sich vor
IGGM April Sale: 5% off WoW TBC Classic Anniversary Gold

Nearly two months have passed since WoW TBC Anniversary Edition launched on February 6, 2026, with most players having hit Level 70, cleared early ...

Geschrieben von salisy am 18.04.2026 04:04:55
Forum: User stellen sich vor