Worker
PHP Manual

Worker::getStacked

(PECL pthreads >= 0.36)

Worker::getStackedStack Analysis

说明

final public int Worker::getStacked ( void )

Returns the number of Stackables waiting to be executed by the referenced Worker

参数

此函数没有参数。

返回值

An integral value

范例

Example #1 Returns the number of objects currently waiting to be executed by the referenced Worker

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

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

class 
My extends Worker {
    public function 
run(){
        
/** ... **/
    
}
}
$my = new My();
/** ... **/
$my->stack(new Work());
/** ... **/
printf("My worker has %d jobs remaining\n"$my->getStacked());
/** ... **/
?>

以上例程会输出:

My worker has 5 jobs remaining


Worker
PHP Manual