PHP Classes

Threads PHP: php_fork

Recommend this page to a friend!
  All requests RSS feed  >  Threads PHP  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Threads PHP

Edit

Picture of Isaac by Isaac - 9 years ago (2015-05-14)

php_fork

This request is clear and relevant.
This request is not clear or is not relevant.

0

Hola

Soy nuevo en el tema de threads, cómo se debe de usar la librería de php_fork.

Ask clarification

2 Recommendations

Forker PHP: Split tasks into multiple forked processes

This package can split tasks into multiple forked processes.

The main class takes an array of data to be processed as the whole task and creates child processes giving one element of the tasks array to be processed by each child process by calling given a given function that will process the respective task data.

It uses a separate storage object to store and retrieve task data to be shared between processes.

Currently it provides different storage classes that can store task data in memory as arrays, in files, or in a MemCached server.
This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Daniel Martinez by Daniel Martinez package author package author Reputation 35 - 9 years ago (2015-06-01) Comment

Te recomiendo Forker, más sencilla de utilizar. A partir de un array de "taks", puedes definir en cuántos subprocesos se realizarán. Por ejemplo, podrías hacer que para cada tarea se crease un subproceso.Por otro lado, no hay que confundir threads (hilos) con copia de procesos (fork).


Thread: A class to implement multi-threaded applications

Wrapper around the pcntl_fork() stuff, with a API set like Java language.
Practical usage is done by extending this class, and re-defining the run() method.
This way PHP developers can enclose logic into a class that extends PHP_Fork, then execute the start() method that forks a child process.
Communications with the forked process is ensured by using a Shared Memory Segment; by using a user-defined signal and this shared memory developers can access to child process methods that returns a serializable variable.

The shared variable space can be accessed with the tho methods:
o void setVariable($name, $value)
o mixed getVariable($name)

$name must be a valid PHP variable name;
$value must be a variable or a serializable object.
Resources (db connections, streams, etc.) cannot be serialized and so they're not correctly handled.

Only runs on *NIX systems, because Windows lacks of the needed pcntl ext.
This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of Dave Smith by Dave Smith Reputation 7620 - 9 years ago (2015-05-14) Comment

This is the class you are talking about, a wrapper for the pcntl extension. It doesn't look like it is maintained anymore. If you are looking for support, you can try posting questions in the class support forum or experts forum to see if anyone has experience working with it.


Recommend package
: 
: