• <small id="26zkx"><ul id="26zkx"></ul></small>
  • Thread::getCurrentThread

    (PECL pthreads >= 2.0.0)

    Thread::getCurrentThread識別

    說明

    public static Thread::getCurrentThread(): Thread

    獲取當(dāng)前執(zhí)行線程的引用。

    參數(shù)

    此函數(shù)沒有參數(shù)。

    返回值

    表示當(dāng)前執(zhí)行線程的對象。

    范例

    示例 #1 獲取當(dāng)前執(zhí)行線程

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

    以上例程會輸出:

    object(My)#2 (0) {
    }