Worker::getStacked

(PECL pthreads >= 2.0.0)

Worker::getStackedStack Analysis

說明

public integer Worker::getStacked ( void )

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

參數

此函式沒有參數。

回傳值

An numeric value

範例

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

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

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

上例將輸出:

My worker has 5 jobs remaining

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top