pthreads Pool 클래스
(PECL pthreads >= 2.0.0)
소개
풀은 조정 가능한 수의 Worker를 위한 컨테이너이자 컨트롤러입니다.
풀링은 pthread에 필요한 방식으로 참조 관리를 포함하여 Worker 기능의 상위 수준 추상화를 제공합니다.
클래스 개요
class Pool {
/* Properties */
protected $size;
protected $class;
protected $workers;
protected $ctor;
protected $last;
/* Methods */
public __construct(int $size, string $class = ?, array $ctor = ?)
public collect(Callable $collector = ?): int
public resize(int $size): void
public shutdown(): void
public submit(Threaded $task): int
public submitTo(int $worker, Threaded $task): int
}
Properties
- size
- 이 풀이 사용할 수 있는 최대 작업자 수
- class
- the class of the Worker
- workers
- references to Workers
- ctor
- 새 Worker의 생성자에 대한 인수
- last
- 사용된 마지막 Worker의 Worker 오프셋
목차
- 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