Worker
Table of Contents
Interfaces
- LimitedWorkerPool
- An interface for worker pools.
- Task
- A runnable unit of execution.
- TaskFailureThrowable
- Common interface for exceptions thrown when Task::run() throws an exception when being executed in a worker.
- Worker
- An interface for a parallel worker thread that runs a queue of tasks.
- WorkerFactory
- Interface for factories used to create new workers.
- WorkerPool
- An interface for worker pools.
Classes
- ContextWorkerFactory
- The built-in worker factory type.
- ContextWorkerPool
- Provides a pool of workers that can be used to execute multiple tasks asynchronously.
- DelegatingWorkerPool
- Execution
- TaskCancelledException
- Will be thrown in case an operation is cancelled.
- TaskFailureError
- TaskFailureException
- WorkerException
Functions
- workerPool() : WorkerPool
- Gets or sets the global worker pool.
- submit() : Execution<TReceive, TSend>
- getWorker() : Worker
- Gets an available worker from the global worker pool.
- createWorker() : Worker
- Creates a worker using the global worker factory.
- workerFactory() : WorkerFactory
- Gets or sets the global worker factory.
Functions
workerPool()
Gets or sets the global worker pool.
workerPool([WorkerPool|null $pool = null ]) : WorkerPool
Parameters
- $pool : WorkerPool|null = null
-
A worker pool instance.
Return values
WorkerPool —The global worker pool instance.
submit()
submit(Task<TReceive, TSend> $task[, Cancellation|null $cancellation = null ]) : Execution<TReceive, TSend>
Parameters
- $task : Task<TReceive, TSend>
-
The task to execute.
- $cancellation : Cancellation|null = null
-
Token to request cancellation. The task must support cancellation for this to have any effect.
Tags
Return values
Execution<TReceive, TSend>getWorker()
Gets an available worker from the global worker pool.
getWorker() : Worker
Return values
WorkercreateWorker()
Creates a worker using the global worker factory.
createWorker() : Worker
Return values
WorkerworkerFactory()
Gets or sets the global worker factory.
workerFactory([WorkerFactory|null $factory = null ]) : WorkerFactory
Parameters
- $factory : WorkerFactory|null = null