Exemple #1
0
        $this->res = fopen("php://stdout", "w");
        /*
         * tell the waiting process we have created symbols and fetch will succeed
         */
        $this->notify();
    }
}
$thread = new Fetching();
/*
* You cannot start synchronized, because the run method will attempt to acquire the thread lock in order to manipulate members
*/
$thread->start();
/*
* Wait for the thread to tell us the members are ready
*/
$thread->wait();
/*
* we just got notified that there are symbols waiting
*/
foreach (array("sym", "arr", "obj", "objs", "res") as $symbol) {
    printf("\$thread->%s: ", $symbol);
    $fetched = $thread->{$symbol};
    if ($fetched) {
        switch ($symbol) {
            /*
             * manual unserialize
             */
            case "objs":
                var_dump(unserialize($fetched));
                break;
            default: