- PHP 手册
- 函数参考
- 进程控制扩展
- pthreads
- Worker
Worker::stack
(PECL pthreads >= 2.0.0)
Worker::stack — 将要执行的任务入栈
说明
public Worker::stack(Threaded&$work
): int
将要执行的任务入栈到 Worker 对象
参数
-
work
-
要被 Worker 执行的 Threaded 派生对象
返回值
入栈之后,Worker 对象栈的大小。
范例
示例 #1 向 Worker 中入栈任务并执行
<?php
$worker = new Worker();
$work = new class extends Threaded {};
var_dump($worker->stack($work));
以上例程会输出:
int(1)
User Contributed Notes
There are no user contributed notes for this page.官方地址:https://www.php.net/manual/en/worker.stack.php