php pthreads:';PHP致命错误'';致命错误';在CLI中
我运行了php pthreads:';PHP致命错误'';致命错误';在CLI中,php,pthreads,Php,Pthreads,我运行了https://github.com/krakjoe/pthreads/tree/seven/examples 在CLI中。 在执行每一个之后,除了预期的结果之外,我还得到了PHP致命错误和致命错误。 例如,在这种情况下https://github.com/krakjoe/pthreads/blob/seven/examples/ClosureFuture.php我会得到: object(Volatile)#6 (2) { [0]=> string(5) "H
https://github.com/krakjoe/pthreads/tree/seven/examples
在CLI中。
在执行每一个之后,除了预期的结果之外,我还得到了PHP致命错误
和致命错误
。
例如,在这种情况下https://github.com/krakjoe/pthreads/blob/seven/examples/ClosureFuture.php
我会得到:
object(Volatile)#6 (2) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
}
array(2) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
}
PHP致命错误:无法声明类Future,因为该名称已在第42行的/var/www/test/index1.PHP中使用
致命错误:无法声明类Future,因为该名称已在第42行的/var/www/test/index1.php中使用
在所有示例中,当扩展类关闭时发生错误
您知道这些错误的原因以及如何纠正它们吗?
任何帮助都将不胜感激
class Future extends Thread {
private function __construct(Closure $closure, array $args = []) {
$this->closure = $closure;
$this->args = $args;
}
public function run() {
$this->synchronized(function() {
$this->result =
($this->closure)(...$this->args);
$this->notify();
});
}
public function getResult() {
return $this->synchronized(function(){
while (!$this->result)
$this->wait();
return $this->result;
});
}
public static function of(Closure $closure, array $args = []) {
$future =
new self($closure, $args);
$future->start();
return $future;
}
protected $owner;
protected $closure;
protected $args;
protected $result;
}//line 42
检查服务器安装的PHP版本。根据doc,它的支持来自(php5>=5.3.0)。检查服务器安装的PHP版本。根据doc,它的支持来自(php5>=5.3.0)。听起来您可能在pthreads中发现了一个bug,或者一些bug,请在github上报告它们 请在报告中包含尽可能多的信息,“致命错误”不是很有用
PHP7和pthreads v3都是预发布版本,引用的示例ClosureFuture在上次提交时刚刚更新,还有一个小改动。听起来您可能在pthreads中发现了一个bug或一些bug,请在github上报告它们 请在报告中包含尽可能多的信息,“致命错误”不是很有用
PHP7和pthreads v3都是预发布版本,引用的示例ClosureFuture在上次提交时刚刚更新,还有一个小改动。感谢回复,我当前的php版本是5.5.8,并且我在版本7.0.0RC4、7.0.0RC3、7.0.0RC2上对其进行了测试。感谢回复,我当前的php版本是5.5.8,并且在7.0.0RC4、7.0.0RC3、7.0.0RC2版本上进行了测试。