Rechercher une fonction PHP

parallel\run

(1.0.0)

parallel\runExecution

Description

parallel\run ( Closure $task ) : ?Future

Shall schedule task for execution in parallel.

parallel\run ( Closure $task , array $argv ) : ?Future

Shall schedule task for execution in parallel, passing argv at execution time.

Retour à la première page de Manuel PHP  Table des matières Haut

Automatic Scheduling

If a \parallel\Runtime internally created and cached by a previous call to parallel\run() is idle, it will be used to execute the task. If no \parallel\Runtime is idle parallel will create and cache a \parallel\Runtime.

Note:

\parallel\Runtime objects created by the programmer are not used for automatic scheduling.

Retour à la première page de Manuel PHP  Table des matières Haut

Liste de paramètres

task

A Closure with specific characteristics.

argv

An array of arguments with specific characteristics to be passed to task at execution time.

Retour à la première page de Manuel PHP  Table des matières Haut

Task Characteristics

Closures scheduled for parallel execution must not:

  • accept or return by reference
  • accept or return internal objects (see notes)
  • execute a limited set of instructions

Instructions prohibited in Closures intended for parallel execution are:

  • yield
  • use by-reference
  • declare class
  • declare named function

Note:

Nested closures may yield or use by-reference, but must not contain class or named function declarations.

Note:

No instructions are prohibited in the files which the task may include.

Retour à la première page de Manuel PHP  Table des matières Haut

Arguments Characteristics

Arguments must not:

  • contain references
  • contain resources
  • contain internal objects (see notes)

Note:

In the case of file stream resources, the resource will be cast to the file descriptor and passed as int where possible, this is unsupported on Windows.

Retour à la première page de Manuel PHP  Table des matières Haut

Internal Objects Notes

Internal objects generally use a custom structure which cannot be copied by value safely, PHP currently lacks the mechanics to do this (without serialization) and so only objects that do not use a custom structure may be shared.

Some internal objects do not use a custom structure, for example parallel\Events\Event and so may be shared.

Closures are a special kind of internal object and support being copied by value, and so may be shared.

Channels are central to writing parallel code and support concurrent access and execution by necessity, and so may be shared.

Avertissement

A user class that extends an internal class may use a custom structure as defined by the internal class, in which case they cannot be copied by value safely, and so may not be shared.

Retour à la première page de Manuel PHP  Table des matières Haut

Valeurs de retour

Avertissement

The return \parallel\Future must not be ignored when the task contains a return or throw statement.

Retour à la première page de Manuel PHP  Table des matières Haut

Exceptions

Avertissement

Shall throw \parallel\Runtime\Error\Closed if \parallel\Runtime was closed.

Avertissement

Shall throw \parallel\Runtime\Error\IllegalFunction if task is a closure created from an internal function.

Avertissement

Shall throw \parallel\Runtime\Error\IllegalInstruction if task contains illegal instructions.

Avertissement

Shall throw \parallel\Runtime\Error\IllegalParameter if task accepts or argv contains illegal variables.

Avertissement

Shall throw \parallel\Runtime\Error\IllegalReturn if task returns illegally.

Rechercher une fonction PHP

Document créé le 30/01/2003, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/php-rf-parallel.run.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : http://php.net

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut