PHP 8.3.4 Released!

Thread::start

(PECL pthreads >= 2.0.0)

Thread::start実行する

説明

public Thread::start(int $options = ?): bool

新しいスレッドを開始し、実装されている run メソッドを実行します。

パラメータ

options

オプションのマスク。継承に関する定数で、デフォルトは PTHREADS_INHERIT_ALL。

戻り値

成功した場合に true を、失敗した場合に false を返します。

例1 スレッドの開始

<?php
class My extends Thread {
public function
run() {
/** ... **/
}
}
$my = new My();
var_dump($my->start());
?>

上の例の出力は以下となります。

bool(true)

add a note

User Contributed Notes

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