Thread::kill
(PECL pthreads >= 2.0.0)
Thread::kill — Execution
Description
public void Thread::kill
( void
)
Forces the referenced Thread to terminate
Warning
The programmer should not ordinarily kill Threads by force
Parameters
This function has no parameters.
Return Values
A boolean indication of success
Examples
Example #1 Kill the referenced Thread
<?php
class T extends Thread {
public function run() {
$stdin = fopen("php://stdin", "r");
while(($line = fgets($stdin))) {
echo $line;
}
}
}
$t = new T();
$t->start();
var_dump($t->kill());
?>
The above example will output:
bool(true)
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для управления процессами программ
- pthreads
- Функция Thread::detach() - Execution
- Функция Thread::getCreatorId() - Identification
- Функция Thread::getCurrentThread() - Identification
- Функция Thread::getCurrentThreadId() - Identification
- Функция Thread::getThreadId() - Identification
- Функция Thread::globally() - Execution
- Функция Thread::isJoined() - State Detection
- Функция Thread::isStarted() - State Detection
- Функция Thread::join() - Synchronization
- Функция Thread::kill() - Execution
- Функция Thread::start() - Execution
Коментарии
This has been removed in pthreads 3 (= php 7)