Ejemplo n.º 1
0
* we just got notified that there are symbols waiting
*/
foreach (array("sym", "arr", "obj", "objs", "res") as $symbol) {
    printf("Thread::fetch(%s): ", $symbol);
    $fetched = $thread->{$symbol};
    if ($fetched) {
        switch ($symbol) {
            /*
             * we need to manually serialize objects here
             */
            case "objs":
                print_r(unserialize($fetched));
                break;
            default:
                var_dump($fetched);
        }
    }
}
/*
* Tell the thread it can continue
*/
$thread->notify();
/*
* Join the thread ( and it's symbols )
*/
$thread->join();
/*
* Show thread structure after join ( will contain all symbols created in the thread )
* @NOTE members of a user declared class should be available in both contexts, else joining symbols will fail ( gracefully )
*/
print_r($thread);