PHP Classes
elePHPant
Icontem

Thread: A class to implement multi-threaded applications

Recommend this page to a friend!

  Author Author  
Picture of Luca Mariano
Name: Luca Mariano <contact>
Classes: 1 package by
Country: Italy Italy


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
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.

  Classes of Luca Mariano  >  Thread  >  Download Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Thread
Base name: php_fork
Description: A class to implement multi-threaded applications
Version: 1.0.0
PHP version: -
License: The PHP License
 
  Groups   Dependents   Trackback   Applications   Files Files  

  Groups  
Group folder image Unix Use of capabilities specific of POSIX, Unix like operating systems View top rated classes
Group folder image Language Constructs to assist in the language control View top rated classes


  Recommendations  

Threads PHP
php_fork


  Other classes that need this package  
Class Why it is needed Dependency
DNServer To implement the DNServer_multithreaded. Conditional
PHP Cron Daemon This class forms the actual thread-generation. Is included by default Required

  Pages that reference this package  
File downloading process in the background (Turkish)
You would not say this for PHP, there is the concept of thread...
Multi threading with PHP
Surfing in Phpclasses I’ve found a really useful (at least for me) class that implements a Java like thread class...
php fork
-
PHP multithreading realization
In PHPClasses I discovered is extremely something useful (at least to me) similar to Java thread class...
PHP: Your imagination is your limit
Do you think PHP was only developed for write Web-Sites?... I invite ...
Threads in PHP
Class: Thread is a wrapper around the pcntl_fork() stuff, with a API set like Java language...

Latest pages that reference packages Latest pages that reference packages


  Applications that use this package  
PHPlet
An application server written in PHP

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Accessible without login Plain text file action_dispatcher.php Example shows a multiprocess application scheme where all processes run a sleep() cycle, and a centralized dispatcher pass them the work.
Accessible without login Plain text file basic.php Example a basic example, only two pseudo-threads that increment a counter simultaneously
Accessible without login Plain text file exec_methods.php Example shows how to execute methods into the child process.
Plain text file Fork.php Class Main class
Accessible without login Plain text file INSTALL Doc. installation instructions
Accessible without login Plain text file passing_vars.php Example shows variable exchange between the parent process and started pseudo-threads.
Accessible without login HTML file php_fork-api.html Doc. API docs
Accessible without login Plain text file simple_controller.php Example shows how to attach a controller to started pseudo-threads.

Install with Composer Install with Composer - Download Download all files: php_fork.tar.gz php_fork.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.