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
<?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)
doc_php
2016-02-24 16:05:27
Comments
Leave a Comment

Please login to continue.