Jamm\Memory\Shm\MultiAccess::get_access_read PHP Метод

get_access_read() публичный Метод

public get_access_read ( &$auto_unlocker_reference )
    public function get_access_read(&$auto_unlocker_reference)
    {
        if ($this->writers_count <= 0 && $this->readers_count <= 0) {
            if (!$this->wait(self::writers)) {
                return false;
            }
            //if somebody are writing here now - we will wait
            $sent = $this->increment(self::readers);
            //increment count of readers - writers will be waiting for us while we read.
            if (!$sent) {
                return false;
            }
        }
        $auto_unlocker_reference = new \Jamm\Memory\KeyAutoUnlocker(array($this, 'release_access_read'));
        $this->readers_count++;
        return true;
    }