PHP Classes

Classes of Luca Mariano

Recommend this page to a friend!
  All class groups  >  All authors  >  Classes of Luca Mariano (1)  >  Mission progress status  >  Reputation  
Picture of Luca Mariano
Name: Luca Mariano <contact>
Classes: 1
Country: Italy Italy
Age: 50
All time rank: 29210 in Italy Italy
Week rank: 195 Up8 in Italy Italy Up
All time users: 8732
Week users: 0
 
  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z  
  Files folder image 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.


  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z