- PHP 手册
- 函数参考
- 进程控制扩展
- pht
The Thread class
(PECL pht >= 0.0.1)
简介
The pht\Thread class abstracts away a native thread. It has an internal task queue, where the methods pht\Thread::addClassTask(), pht\Thread::addFunctionTask(), and pht\Thread::addFileTask() push new tasks onto this queue. Invoking the pht\Thread::start() method will cause the new thread to be spawned, where it will then begin working through the task queue. A thread may be reused for any number of tasks.
类摘要
pht\Thread { /* 方法 */ public addClassTask ( string$className
[, mixed $...ctorArgs
] ) : void
public addFileTask
( string $fileName
[, mixed $...globals
] ) : void
public addFunctionTask
( callable $func
[, mixed $...funcArgs
] ) : void
public join
( void
) : void
public start
( void
) : void
public taskCount
( void
) : int
}
Table of Contents
- pht\Thread::addClassTask — Class threading
- pht\Thread::addFileTask — File threading
- pht\Thread::addFunctionTask — Function threading
- pht\Thread::join — Joins a thread
- pht\Thread::start — Starts the new thread
- pht\Thread::taskCount — Gets a thread's task count
User Contributed Notes
There are no user contributed notes for this page.官方地址:https://www.php.net/manual/en/class.pht-thread.php