当前位置: 首页>>代码示例>>PHP>>正文


PHP Thread::getThreadId方法代码示例

本文整理汇总了PHP中Thread::getThreadId方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::getThreadId方法的具体用法?PHP Thread::getThreadId怎么用?PHP Thread::getThreadId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thread的用法示例。


在下文中一共展示了Thread::getThreadId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: spawnWorker

 private function spawnWorker()
 {
     $results = new SharedData();
     $resultCodes = new SharedData();
     $thread = new Thread($results, $resultCodes, $this->ipcUri);
     if (!$thread->start()) {
         throw new \RuntimeException('Worker thread failed to start');
     }
     $worker = new Worker();
     $worker->id = $thread->getThreadId();
     $worker->results = $results;
     $worker->resultCodes = $resultCodes;
     $worker->thread = $thread;
     $this->pendingWorkers[$worker->id] = $worker;
     $this->pendingWorkerCount++;
     return $worker;
 }
开发者ID:xingcuntian,项目名称:thread,代码行数:17,代码来源:Dispatcher.php

示例2: testThreadIds

 public function testThreadIds()
 {
     $thread = new Thread();
     $this->assertInternalType("int", $thread->getThreadId());
     $this->assertInternalType("int", Thread::getCurrentThreadId());
 }
开发者ID:krakjoe,项目名称:pthreads-polyfill,代码行数:6,代码来源:ThreadTest.php

示例3: Thread

    $thread = new Thread();
    $thread->setThreadTitle(trim($_POST['threadTitle']));
    $userName = trim($_POST['userName']);
    $user = User::getByName($userName);
    if ($user == null) {
        $user = new User();
        $user->setUserName($userName);
        $user->setRegistryDate(date('Y-m-d H:i:s'));
        $user->insert();
    }
    $thread->setUserId($user->getUserId());
    $thread->setCreated(date('Y-m-d H:i:s'));
    $thread->insert();
    $post = new Post();
    $post->setUserId($user->getUserId());
    $post->setThreadId($thread->getThreadId());
    $post->setCreated(date('Y-m-d H:i:s'));
    $post->setContent(trim($_POST['content']));
    $post->insert();
    header("Location: /index.php?thread=" . $thread->getThreadId());
    die;
}
?>
<html>
    <head>
        <title>Форум</title>
        <meta charset="utf-8"/>
    </head>
    <body> <?php 
$view = View::getView(View::VIEW_MAIN);
$view->show();
开发者ID:echurmanov,项目名称:php-simple-forum,代码行数:31,代码来源:index.php


注:本文中的Thread::getThreadId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。