©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PECL pthreads >= 2.0.9)
Threaded::from — Creation
$run
[, Closure $construct
[, array $args
]] )Creates an anonymous Threaded object from closures
run
The closure to use for ::run
construct
The constructor to use for anonymous object
args
The arguments to pass to constructor
A new anonymous Threaded object
Example #1 Thread safe objects from closures
<?php
$pool = new Pool ( 4 );
$pool -> submit ( Collectable :: from (function(){
echo "Hello World" ;
$this -> setGarbage ();
}));
$pool -> shutdown ();
?>
以上例程会输出:
Hello World