Implements an execution context using native multi-threading.
The thread context is not itself threaded. A local instance of the context is maintained both in the context that creates the thread and in the thread itself.
Checks if threading is enabled.
Creates and starts a new thread.
Type | Parameter | Description | Default Value |
---|---|---|---|
callable | $function | The callable to invoke in the thread. First argument is an instance of \Amp\Parallel\Sync\Channel. | none |
mixed | ... $args | Additional arguments to pass to the given callable. | none |
Creates a new thread.
Type | Parameter | Description | Default Value |
---|---|---|---|
callable | $function | The callable to invoke in the thread. First argument is an instance of \Amp\Parallel\Sync\Channel. | none |
mixed | ... $args | Additional arguments to pass to the given callable. | none |
Returns the thread to the condition before starting. The new thread can be started and run independently of the first thread.
Kills the thread if it is still running.
Checks if the context is running.
Spawns the thread and begins the thread's execution.
Immediately kills the context.
Type | Parameter | Description | Default Value |
---|---|---|---|
mixed | $data | No documentation. | none |