Jamm\Memory\Shm\MultiAccess::wait PHP 메소드

wait() 보호된 메소드

Wait for queue. If this function has returned 'false', access should not be granted.
protected wait ( integer $type = self::writers ) : boolean
$type integer
리턴 boolean
    protected function wait($type = self::writers)
    {
        $q = $this->select_q($type);
        if (empty($q)) {
            return false;
        }
        $stat = msg_stat_queue($q);
        if ($stat['msg_qnum'] > 0) {
            $starttime = microtime(true);
            do {
                $stat = msg_stat_queue($q);
                if (empty($stat)) {
                    break;
                }
                if ($stat['msg_qnum'] <= 0) {
                    break;
                }
                if (microtime(true) - $starttime > $this->max_wait_time) {
                    return false;
                }
            } while ($stat['msg_qnum'] > 0);
        }
        return true;
    }