Pool (class)

The Pool class

Introduction

(PECL pthreads >= 2.0.0)

A Pool is a container for, and controller of, an adjustable number of Workers.

Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads.

Class synopsis

Pool {
/* Properties */
protected $size ;
protected $class ;
protected $workers ;
protected $work ;
protected $ctor ;
protected $last ;
/* Methods */
public int collect ([ Callable $collector ] )
public Pool __construct ( integer $size [, string $class [, array $ctor ]] )
public void resize ( integer $size )
public void shutdown ( void )
public int submit ( Threaded $task )
public int submitTo ( int $worker , Threaded $task )
}

Properties

size

maximum number of Workers this Pool can use

class

the class of the Worker

ctor

the arguments for constructor of new Workers

workers

references to Workers

work

references to Threaded objects submitted to the Pool

last

offset in workers of the last Worker used

Table of Contents

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/class.pool.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部