首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

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 $ctor ;

protected $last ;

/* Methods */

代码语言:javascript
复制
public int collect ([ Callable $collector ] )
代码语言:javascript
复制
public Pool __construct ( integer $size [, string $class [, array $ctor ]] )
代码语言:javascript
复制
public void resize ( integer $size )
代码语言:javascript
复制
public void shutdown ( void )
代码语言:javascript
复制
public int submit ( Threaded $task )
代码语言:javascript
复制
public int submitTo ( int $worker , Threaded $task )

}

Properties

size

maximum number of Workers this Pool can use

class

the class of the Worker

workers

references to Workers

ctor

the arguments for constructor of new Workers

last

offset in workers of the last Worker used

Table of Contents

  • Pool::collect — Collect references to completed tasks
  • Pool::__construct — Creates a new Pool of Workers
  • Pool::resize — Resize the Pool
  • Pool::shutdown — Shutdown all workers
  • Pool::submit — Submits an object for execution
  • Pool::submitTo — Submits a task to a specific worker for execution

← Modifiers

Pool::collect →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com