/** * Wait for a signal on a Condition Variable, optionally specifying a timeout to limit waiting time. * * @param int $condition A handle to a Condition Variable returned by a previous call to Cond::create() * @param int $mutex A handle returned by a previous call to Mutex::create() and owned (locked) by the caller. * @param int $timeout An optional timeout, in microseconds * * @return bool A boolean indication of success */ public static function wait($condition, $mutex, $timeout = null) { if (fhread_cond_wait($condition, $mutex) === 0) { return true; } return false; }
/** * Waits for the state codition gets a signal * * @return void */ public function wait() { $this->setState(self::STATE_WAITING); fhread_cond_wait($this->syncNotify, $this->syncMutex); }