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)

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top