Documentation

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

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
template
template
template

Executes a Task on the global worker pool.

Return values
Execution<TReceive, TSend>

getWorker()

Gets an available worker from the global worker pool.

getWorker() : Worker
Return values
Worker

createWorker()

Creates a worker using the global worker factory.

createWorker() : Worker
Return values
Worker

        
On this page

Search results