@return boolean

@throws MutexException
969727
function is_free() {
            if ($this->_lock_acquired) {
                return false;
            }
            if (!file_exists(dirname($this->filename))) {
                throw new MutexException('Folder "'.dirname($this->filename).'" does not exist', 1);
            } elseif (!is_dir(dirname($this->filename))) {
                throw new MutexException('Folder "'.dirname($this->filename).'" does not exist', 4);
            } elseif (!is_writable(dirname($this->filename))) {
                throw new MutexException('Folder "'.dirname($this->filename).'" is not writable', 2);
            } elseif (file_exists($this->filename) and !is_writable($this->filename)) {
                throw new MutexException('File "'.$this->filename.'" is not writable', 3);
            }

            $fo = fopen($this->filename, 'ab');
            $result = flock($fo, LOCK_EX | LOCK_NB);
            flock($fo, LOCK_UN);
            fclose($fo);

            return $result;
        }
224746
public function canEdit(): bool
    {
        if ($this->isPendingDeletion()) {
            return false;
        }

        if (Auth::isManager($this->record->tree())) {
            return true;
        }

        // Members cannot edit RESN, CHAN and locked records
        return Auth::isEditor($this->record->tree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() !== 'RESN' && $this->getTag() !== 'CHAN';
    }
676468
public function lock()
    {
        $this->_validate();
        $_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = true;
        return true;
    }
481003
protected function acquireMutex()
    {
        $this->mutex = Instance::ensure($this->mutex, Mutex::className());
        return $this->mutex->acquire($this->composeMutexName());
    }
1194106
public function podiumPin()
    {
        $this->pinned = !$this->pinned;
        if ($this->save()) {
            Log::info($this->pinned ? 'Thread pinned' : 'Thread unpinned', $this->id, __METHOD__);
            return true;
        }
        return false;
    }
934129
public function getIsSingleIterator()
	{
		if ( count( $this->buffer ) > 1)
			return false;
		else
		{
			if ( $this->src->getIsFinished() && count( $this->buffer ) == 1)
			{
				return true;
			}
			return $this->getIsSingleIterator();
		}
	}
539382
protected function lock() {

        $this->db->lockTable($this->getTable());
        $this->locked = true;

        return true;
    }
667326
def mute(self):
        

        response = self.renderingControl.GetMute([
            ('InstanceID', 0),
            ('Channel', 'Master')
        ])
        mute_state = response['CurrentMute']
        return bool(int(mute_state))
943930
protected function waitPid()
    {
        start:
        $pid = \pcntl_waitpid(-1, $status, WNOHANG);
        if ($pid > 0) {
            foreach ($this->collections as $col) {
                foreach ($col->threads as $k => $t) {
                    if ($t->pid === $pid) {
                        $t->setTerminated();
                        unset($col->threads[$k]);
                        goto start;
                    }
                }
            }
        }

        return false;
    }
1082185
public function unlock()
    {
        if ($this->fp !== null) {
            flock($this->fp, LOCK_UN);
            fclose($this->fp);
            $this->fp = null;
        }

        return true;
    }
647831
public function wait(): bool
    {
        if (!$this->pid) {
            throw new BadMethodCallException('wait can only be called from the parent of a forked process');
        }

        // Cascade the call to waitAll for asynchronous processes
        if ($this->async) {
            return $this->waitAll();
        }

        // Wait for the process to complete
        pcntl_waitpid($this->pid, $status);

        // Capture any messages returned by the child process
        if ($msg = $this->channel->receive()) {
            $this->messages[] = $msg;
        }

        // If the process did not exit gracefully, mark it as failed
        if (!pcntl_wifexited($status)) {
            return false;
        }

        // If the process exited gracefully, check the exit code
        return pcntl_wexitstatus($status) === 0;
    }
1360197
def mute(self):
        

        response = self.renderingControl.GetMute([
            ('InstanceID', 0),
            ('Channel', 'Master')
        ])
        mute_state = response['CurrentMute']
        return True if int(mute_state) else False
724292
public function isLockedOut()
    {
        /** @var DBDatetime $lockedOutUntilObj */
        $lockedOutUntilObj = $this->dbObject('LockedOutUntil');
        if ($lockedOutUntilObj->InFuture()) {
            return true;
        }

        $maxAttempts = $this->config()->get('lock_out_after_incorrect_logins');
        if ($maxAttempts <= 0) {
            return false;
        }

        $idField = static::config()->get('unique_identifier_field');
        $attempts = LoginAttempt::getByEmail($this->{$idField})
            ->sort('Created', 'DESC')
            ->limit($maxAttempts);

        if ($attempts->count() < $maxAttempts) {
            return false;
        }

        foreach ($attempts as $attempt) {
            if ($attempt->Status === 'Success') {
                return false;
            }
        }

        // Calculate effective LockedOutUntil
        /** @var DBDatetime $firstFailureDate */
        $firstFailureDate = $attempts->first()->dbObject('Created');
        $maxAgeSeconds = $this->config()->get('lock_out_delay_mins') * 60;
        $lockedOutUntil = $firstFailureDate->getTimestamp() + $maxAgeSeconds;
        $now = DBDatetime::now()->getTimestamp();
        if ($now < $lockedOutUntil) {
            return true;
        }

        return false;
    }
986261
public function isLocked(): bool
	{
		return $this->locked_until !== null && $this->locked_until->getTimestamp() >= Time::now()->getTimestamp();
	}
1302389
public static boolean existsBegunTxOnThread() {
        final Stack<BegunTx<?>> stack = threadLocal.get();
        return stack != null ? !stack.isEmpty() : false;
    }
130453
private boolean mute() {
    isMuted = true;
    setSoundChipText(getContext().getString(R.string.muted));
    showSoundChip();
    soundFabOff();
    return isMuted;
  }
512463
public function mutexName()
    {
        if (Eye::laravelVersionIs('>=', '5.2.0')) {
            return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command);
        }

        return 'framework/schedule-'.md5($this->expression.$this->command);
    }