PHP Class Cml\Vendor\PhpThread

Show file Open project: linhecheng/cmlphp

Public Properties

Property Type Description
$success array 已完成的任务队列(查看处理结果)

Protected Properties

Property Type Description
$queue array 线程队列
$tasks array 当前任务队列

Public Methods

Method Description
__construct ( integer $max = 10, boolean $saveSuccess = false, integer $readDataLen = 1024, integer $timeout = 3 ) 构造函数
add ( string $host, string $path = '/' ) 往线程队列添加任务
getSuccessInfo ( ) : array 已完成的任务队列(查看处理结果)
run ( ) : array 执行线程队列里的所有任务

Private Methods

Method Description
makeTask ( ) : integer 创建任务
processTask ( array &$task ) 处理任务

Method Details

__construct() public method

构造函数
public __construct ( integer $max = 10, boolean $saveSuccess = false, integer $readDataLen = 1024, integer $timeout = 3 )
$max integer 最大线程数
$saveSuccess boolean 是否保存成功的信息
$readDataLen integer 读取的字节数
$timeout integer 等待超时时间

add() public method

往线程队列添加任务
public add ( string $host, string $path = '/' )
$host string 服务器
$path string 任务程序路径

getSuccessInfo() public method

已完成的任务队列(查看处理结果)
public getSuccessInfo ( ) : array
return array

run() public method

执行线程队列里的所有任务
public run ( ) : array
return array

Property Details

$queue protected property

线程队列
protected array $queue
return array

$success public property

已完成的任务队列(查看处理结果)
public array $success
return array

$tasks protected property

当前任务队列
protected array $tasks
return array