Mutex::create

(PECL pthreads >= 2.0.0) Create a Mutex final public static long Mutex::create ([ boolean $lock ] ) Create, and optionally lock a new Mutex for the caller Parameters: lock Setting lock to true will lock the Mutex for the caller before returning the handle Returns: A newly created and optionally locked Mutex handle

Pool::submitTo

(PECL pthreads >= 2.0.0) Submits an object for execution public integer Pool::submitTo ( integer $worker, Threaded $task ) Submit the object to the specified Worker in the Pool Parameters: worker The worker for execution task The task for execution Returns: the identifier of the Worker that accepted the obje

Pool::submit

(PECL pthreads >= 2.0.0) Submits an object for execution public integer Pool::submit ( Threaded $task ) Submit the task to the next Worker in the Pool Parameters: size The task for execution Returns: the identifier of the Worker executing the object Examples: Submitting Tasks

Pool::shutdown

(PECL pthreads >= 2.0.0) Shutdown all Workers public void Pool::shutdown ( void ) Shutdown the Workers in this Pool Returns: void

Pool::resize

(PECL pthreads >= 2.0.0) Resize the Pool public void Pool::resize ( integer $size ) Resize the Pool Parameters: size The maximum number of Workers this Pool can create Returns: void

Pool::__construct

(PECL pthreads >= 2.0.0) Creates a new Pool of Workers public Pool Pool::__construct ( integer $size, string $class [, array $ctor ] ) Construct a new Pool of Workers Parameters: size The maximum number of Workers this Pool can create class The class for new Workers ctor An array of arguments to be

Pool::collect

(PECL pthreads >= 2.0.0) Collect references to completed tasks public void Pool::collect ( Callable $collector ) Allows the Pool to collect references determined to be garbage by the given collector Parameters: collector A Callable collector Returns: void Examples: Creating Pools

Method Modifiers

Examples: protected method example: protected methods can only be executed by one Thread at a time. pthreads overrides the functionality of the protected and private method modifiers in order to provide functionality more suited to multi-threaded objects. pthreads applies this functionality to all Threaded objects from creation. <?php class ExampleThread extends Thread {     public function run() {         /* thread code */         if ($this->synchronized()) {

Collectable::setGarbage

(PECL pthreads >= 2.0.8) Mark an object as garbage public void Collectable::setGarbage ( void ) Should be called once per object when the object is finished being executed or referenced. See also: Collectable::isGarbage() -

Collectable::isGarbage

(PECL pthreads >= 2.0.8) Determine whether an object has been marked as garbage public bool Collectable::isGarbage ( void ) Can be called in Pool::collect() to determine if this object is garbage. See also: Pool::collect() -