Worker::stack
PHP function
Edit on GitHub ✎
(PECL pthreads >= 2.0.0)
Stacking work
Description
Worker::stack(Threaded $work): int
Appends the new work to the stack of the referenced worker.
Parameters
workA
Threadedobject to be executed by the worker.
Return Values
The new size of the stack.
Examples
Stacking a task for execution onto a worker
php
<?php
$worker = new Worker();
$work = new class extends Threaded {};
var_dump($worker->stack($work));The above example will output:
output
int(1)