The parallel\Channel class

(0.9.0)

Unbuffered Channels

An unbuffered channel will block on calls to parallel\Channel::send() until there is a receiver, and block on calls to parallel\Channel::recv() until there is a sender. This means an unbuffered channel is not only a way to share data among tasks but also a simple method of synchronization.

An unbuffered channel is the fastest way to share data among tasks, requiring the least copying.

Buffered Channels

A buffered channel will not block on calls to parallel\Channel::send() until capacity is reached, calls to parallel\Channel::recv() will block until there is data in the buffer.

Closures over Channels

A powerful feature of parallel channels is that they allow the exchange of closures between tasks (and runtimes).

When a closure is sent over a channel the closure is buffered, it doesn't change the buffering of the channel transmitting the closure, but it does effect the static scope inside the closure: The same closure sent to different runtimes, or the same runtime, will not share their static scope.

This means that whenever a closure is executed that was transmitted by a channel, static state will be as it was when the closure was buffered.

Anonymous Channels

The anonymous channel constructor allows the programmer to avoid assigning names to every channel: parallel will generate a unique name for anonymous channels.

Klassenbeschreibung

final class parallel\Channel {
/* Anonymous Constructor */
public __construct()
public __construct(int $capacity)
/* Access */
public make(string $name): Channel
public make(string $name, int $capacity): Channel
public open(string $name): Channel
/* Sharing */
public recv(): mixed
public send(mixed $value): void
/* Closing */
public close(): void
/* Constant for Infinitely Buffered */
const Infinite;
}

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

Löschen nach einen gewissen Datum in einer TXT-Datenbank

Hier $datenbank = anzeigen.php"; steigt PHP doch mit einem Fehler aus. Außerdem ist es nicht gerade sinnvoll, einer Datendatei die Endung .php z ...

Geschrieben von scatello am 12.11.2025 19:49:12
Forum: Off-Topic Diskussionen
Löschen nach einen gewissen Datum in einer TXT-Datenbank

Hallo php Gemeinde, ich bin ein Anfänger und benötige eure Hilfe. Ich habe eine kleine TXT-Datenbank mit Anzeigen die nach einen festgelegten Ab ...

Geschrieben von maiky am 12.11.2025 11:27:04
Forum: Off-Topic Diskussionen
Wie kann ich eine effiziente Batch-Verarbeitung in PHP mit PDO umsetzen?

Guten Morgen roseblack, Schau dir mal die Statements "LIMIT" sowie "OFFSET" an. Damit kannst du Menge der zurückgegebenen Records bestimmen. htt ...

Geschrieben von ninadelgado am 12.11.2025 11:08:46
Forum: PHP Developer Forum
Benutzt jemand PHPRUNNER ?

Du möchtest, dass beim Auswählen einer PLZ in einem Dropdown-Menü der entsprechende Ort automatisch in das Feld „ORT“ eingetragen wird. Die ...

Geschrieben von ahunaa am 12.11.2025 05:51:01
Forum: Off-Topic Diskussionen