//usleep(1000); /* simulate some work */
                if ($next->isWaiting()) {
                    printf("%s: %lu notifying %lu: %d\n", __CLASS__, $this->getThreadId(), $this->next, $next->notify());
                }
                $next->join();
                printf("%s: %lu testing again ... %s/%d\n", __CLASS__, $this->getThreadId(), $next->my, $next->scopeTestFunc());
            }
        } else {
            printf("%s: %lu failed to find %lu\n", __CLASS__, $this->getThreadId(), $this->other);
        }
        printf("%s: %lu notified: %d\n", __CLASS__, $this->getThreadId(), $this->wait());
    }
}
printf("Process: running\n");
$test = new ScopeTest();
$test3 = new ScopeTest();
$test->start();
$test3->start();
$test2 = new ScopeTest2($test->getThreadId(), $test3->getThreadId());
$test2->start();
printf("Process: notifying %lu: %d\n", $test2->getThreadId(), $test2->notify());
if ($test->isWaiting()) {
    /*
     * If importing has been disabled then the responsability to notify the waiting thread must fall back to the Process to avoid deadlock
     */
    printf("Process: notifying %lu: %d\n", $test->getThreadId(), $test->notify());
}
if ($test3->isWaiting()) {
    /*
     * If importing has been disabled then the responsability to notify the waiting thread must fall back to the Process to avoid deadlock
     */
示例#2
0
	function a(ScopeTest $a) {
		$a->c();
		$a->d($a);
	}