Threaded::from

(PECL pthreads >= 2.0.9)

Threaded::fromCreation

설명

public Threaded Threaded::from ( Closure $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

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top