PHP 8.5.0 Beta 3 available for testing

Worker::stack

(PECL pthreads >= 2.0.0)

Worker::stack โ€” Stacking work

่ชฌๆ˜Ž

public Worker::stack(Threaded &$work): int

Appends the new work to the stack of the referenced worker.

ใƒ‘ใƒฉใƒกใƒผใ‚ฟ

work

A Threaded object to be executed by the worker.

ๆˆปใ‚Šๅ€ค

The new size of the stack.

ไพ‹

ไพ‹1 Stacking a task for execution onto a worker

<?php
$worker
= new Worker();
$work = new class extends Threaded {};

var_dump($worker->stack($work));

ไธŠใฎไพ‹ใฎๅ‡บๅŠ›ใฏไปฅไธ‹ใจใชใ‚Šใพใ™ใ€‚

int(1)

๏ผ‹add a note

User Contributed Notes

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