本文整理汇总了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;
}
示例2: testThreadIds
public function testThreadIds()
{
$thread = new Thread();
$this->assertInternalType("int", $thread->getThreadId());
$this->assertInternalType("int", Thread::getCurrentThreadId());
}
示例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();