« Thread::join
Worker »

Thread::start

(PECL pthreads >= 2.0.0)

Thread::start — 実行する

説明

public function 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)
関連キーワード:
Thread   start   options   スレッド   開始   join   Worker   pthreads   実装   マスク   継承   定数   成功   extends   dump
関連する関数・ページ:
thread.join   thread.getcreatorid   thread.getthreadid   thread.isstarted   thread.getcurrentthread   thread.getcurrentthreadid