略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Worker::stack

2024-04-28

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 noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/worker.stack.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3