Worker
PHP Manual

Worker::stack

(PECL pthreads >= 2.0.0)

Worker::stackStacking

Descrizione

public integer Worker::stack ( Threaded &$work )

Appends the referenced object to the stack of the referenced Worker

Elenco dei parametri

work

Threaded object to be executed by the referenced Worker

Valori restituiti

The new length of the stack

Esempi

Example #1 Stacking objects for execution in Workers

<?php
class Work extends Threaded {
    
/** ... **/

    
public function run(){
        
/** ... **/
    
}
}

$my = new Worker();
$work = new Work();
/** ... **/
var_dump($my->stack($work));
/** ... **/
?>

Il precedente esempio visualizzerĂ :

int(1)


Worker
PHP Manual