Thread::kill

(PECL pthreads >= 2.0.0)
Execution
public void Thread::kill ( void )

Forces the referenced Thread to terminate

Returns:

A boolean indication of success

The programmer should not ordinarily kill Threads by force

Examples:
Kill the referenced Thread
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
class 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)
doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.