"This function has no parameters" and "void" in description, but in example unnamed function passed. Looks like parameter not "void", but "callable".
(PECL pthreads < 3.0.0)
Thread::globally — 执行
pthreads v3 中已移除此方法。
此函数没有参数。
被调用代码块的返回值
Example #1 在全局范围执行代码块
<?php
class My extends Thread {
public function run() {
global $std;
Thread::globally(function(){
$std = new stdClass;
});
var_dump($std);
}
}
$my = new My();
$my->start();
?>
以上例程会输出:
object(stdClass)#3 (0) { }
"This function has no parameters" and "void" in description, but in example unnamed function passed. Looks like parameter not "void", but "callable".