Rechercher une fonction PHP

parallel\Runtime::run

(0.8.0)

parallel\Runtime::runExecution

Description

public parallel\Runtime::run ( Closure $task ) : ?Future

Shall schedule task for execution in parallel.

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

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

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents Haut

Parameters

task

A Closure with specific characteristics.

argv

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

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents 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.

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents 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.

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents 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.

Warning

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.

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents Haut

Return Values

Warning

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

PHP: parallel\Runtime::run - Manual Home of Manuel PHP  Contents Haut

Exceptions

Warning

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

Warning

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

Warning

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

Warning

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

Warning

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

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-parallel-runtime.run.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut