pthreads Worker 클래스
(PECL pthreads >= 2.0.0)
소개
Worker 스레드에는 영구 컨텍스트가 있으므로 대부분의 경우 스레드를 통해 사용해야 합니다.
Worker가 시작되면 실행 메서드가 실행되지만 스레드는 다음 조건 중 하나가 충족될 때까지 떠나지 않습니다.
- the Worker goes out of scope (no more references remain)
- the programmer calls shutdown
- the script dies
이것은 프로그래머가 실행 전반에 걸쳐 컨텍스트를 재사용할 수 있음을 의미합니다. Worker의 스택에 개체를 배치하면 Worker가 스택된 개체 실행 메서드를 실행하게 됩니다.
클래스 개요
class Worker extends Thread implements Traversable, Countable, ArrayAccess {
/* Methods */
public collect(Callable $collector = ?): int
public getStacked(): int
public isShutdown(): bool
public shutdown(): bool
public stack(Threaded &$work): int
public unstack(): int
/* Inherited methods */
public Thread::getCreatorId(): int
public static Thread::getCurrentThread(): Thread
public static Thread::getCurrentThreadId(): int
public Thread::getThreadId(): int
public Thread::isJoined(): bool
public Thread::isStarted(): bool
public Thread::join(): bool
public Thread::start(int $options = ?): bool
}
목차
- Worker::collect — Collect references to completed tasks
- Worker::getStacked — Gets the remaining stack size
- Worker::isShutdown — State Detection
- Worker::shutdown — Shutdown the worker
- Worker::stack — Stacking work
- Worker::unstack — Unstacking work