Check to see if there are outstanding reboot locks that may delay the reboot, returning
false if there are none.
161156
protected boolean checkLocks ()
    {
        if (_rebootLocks.isEmpty()) {
            return false;
        }

        log.info("Reboot delayed due to outstanding locks", "locks", _rebootLocks.elements());
        broadcast("m.reboot_delayed");
        (_interval = _omgr.newInterval(new Runnable() {
            public void run () {
                doWarning(getWarnings().length, 0);
            }
        })).schedule(60 * 1000);
        return true;
    }
1365846
public function isLocked() {
		$options = get_option( 'pressbooks_export_options' );
		if ( realpath( $this->getLockDir( false ) . '/lock.json' ) && isset( $options['theme_lock'] ) && 1 === absint( $options['theme_lock'] ) ) {
			return true;
		}
		return false;
	}
1156733
def is_locked_by_me(self):
        
        
        ## get pid of lock
        lock_pid = self.lock_pid()

        ## not locked
        if lock_pid is None:
            logger.debug('Lock {} is not aquired.'.format(self.lock_filename))
            return False
        
        ## locked by me
        if self.pid == lock_pid:
            logger.debug('Lock {} is aquired by me (pid: {}).'.format(self.lock_filename, self.pid))
            return True

        ## locked by alive process
        try:
            os.kill(lock_pid, 0)
            logger.debug('Lock {} is aquired by another (alive) process (pid: {}).'.format(self.lock_filename, lock_pid))
        
        ## locked by dead process
        except OSError:
            logger.debug('Lock {} is aquired by a dead process (pid: {}).'.format(self.lock_filename, lock_pid))
            try:
                lock_fd = os.open(self.lock_filename, os.O_RDWR)
            except FileNotFoundError:
                logger.debug('The lock is now removed by another process.')
            else:
                try:
                    fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
                except BlockingIOError:
                    logger.debug('The lock will be removed by another process.')
                else:
                    if self.lock_pid() == lock_pid:
                        os.remove(self.lock_filename)
                        fcntl.lockf(lock_fd, fcntl.LOCK_UN)
                        logger.debug('The lock is removed by me.')
                    else:
                        logger.debug('The lock is substituted by another lock.')
                os.close(lock_fd)
        return False
897723
def is_boot_completed(self):
        """"""
        completed = self.adb.getprop('sys.boot_completed')
        if completed == '1':
            self.log.debug('Device boot completed.')
            return True
        return False
656531
public final boolean tryLockForWrite(L locker, long timeout, TimeUnit unit)
        throws InterruptedException
    {
        if (Thread.interrupted()) {
            throw new InterruptedException();
        }
        if (!tryLockForWrite(locker)) {
            long start = System.nanoTime();
            Result upgradeResult = tryLockForUpgrade_(locker, timeout, unit);
            if (upgradeResult == Result.FAILED) {
                return false;
            }
            if (!tryLockForWrite(locker)) {
                unlockFromUpgrade(locker);
                if ((timeout = unit.toNanos(timeout) - (System.nanoTime() - start)) <= 0) {
                    return false;
                }
                if (!lockForWriteQueuedInterruptibly(locker, addWriteWaiter(), timeout)) {
                    return false;
                }
            }
            if (upgradeResult == Result.ACQUIRED) {
                // clear upgrade state bit to indicate automatic upgrade
                while (!clearUpgradeLock(mState)) {}
            } else {
                // undo automatic upgrade count increment
                mUpgradeCount--;
            }
        }
        return true;
    }
1298612
def needs_check(self):
        
        if self.lastcheck is None:
            return True
        return time.time() - self.lastcheck >= self.ipchangedetection_sleep
47725
function isTaskLocked(task) {
  if(task.semaphore) {
    if(!task.semaphore.ttl) {
      throw new TypeError('TimeToLiveNotPresent');
    }
    return ( (timestamp() - task.semaphore.time) < task.semaphore.ttl );
  }
  return false;
}
1184813
public boolean withEveryRetryWaitFor(int time, TimeUnit units) {
        for (int i = 1; i <= retries; i++) {
            if (openSocket()) {
                return true;
            }
            sleepFor(time, units);
        }
        return 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;
    }
593065
public static boolean lockingVows() {
        List<InitiatorMailbox> lockedMailboxes = new ArrayList<InitiatorMailbox>();
        for (InitiatorMailbox im : m_allInitiatorMailboxes) {
            if (Thread.holdsLock(im)) {
                lockedMailboxes.add(im);
            }
        }
        if (lockedMailboxes.size() > 1) {
            String msg = "Unexpected concurrency error, a thread locked two initiator mailboxes. ";
            msg += "Mailboxes for site id/partition ids ";
            boolean first = true;
            for (InitiatorMailbox m : lockedMailboxes) {
                msg += CoreUtils.hsIdToString(m.m_hsId) + "/" + m.m_partitionId;
                if (!first) {
                    msg += ", ";
                }
                first = false;
            }
            VoltDB.crashLocalVoltDB(msg, true, null);
        }
        return true;
    }
1083344
public boolean isUserLocked(CmsUser user) {

        Set<String> keysForUser = getKeysForUser(user);
        for (String key : keysForUser) {
            CmsUserData data = m_storage.get(key);
            if ((data != null) && data.isDisabled()) {
                return true;
            }
        }
        return false;
    }
368831
def is_locked(lock):
    
    if hasattr(lock, 'locked'):
        return lock.locked()
    elif hasattr(lock, '_is_owned'):
        return lock._is_owned()
    else:
        raise TypeError('expecting Lock/RLock')
960469
def check_for_maintenance(self):
        '''
        
        '''
        numrevs = self.conn.get_one("SELECT count(revnum) FROM csetLog")[0]
        if numrevs >= SIGNAL_MAINTENACE_CSETS:
            return True
        return False
371077
def __checkLock(self):
        
        if self._isLocked:
            if (time.time() - self._timer) > TIMEOUT_TIMES[self._operation]:
                self.__unLock()
                return False
            return True
        return False
1323290
boolean detectDeadlock(Locker acquirer, Lock l, int mode) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "detectDeadlock", new Object[] { acquirer, l,
                                                         modeStrs[mode] });
        }

        boolean result = false;

        //----------------------------------------------------------------
        // Iterate through the holders of the given lock and determine if
        // any of them are waiting on a lock held by the requestor. If
        // any of them are then a deadlock exists.
        //----------------------------------------------------------------

        Enumeration holders = l.getHolders();
        while (holders.hasMoreElements()) {
            if (lockerWaitingOn((Locker) holders.nextElement(), acquirer)) {
                result = true;
                break;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "detectDeadlock:" + result);
        }
        return result;

    }
396490
def __checkExpiration(self, mtime=None):
        '''
            
        '''
        if not self.maxLockAge:
            return False

        if mtime is None:
            try:
                mtime = os.stat(self.lockPath).st_mtime
            except FileNotFoundError as e:
                return False

        if mtime < time.time() - self.maxLockAge:
            return True

        return False
242254
def wait_for_lock(self, lockname, locktime=60, auto_renewal=False):
        '''  '''
        pid = os.getpid()
        caller = inspect.stack()[0][3]
        try:
            # rl = redlock.Redlock([{"host": settings.REDIS_SERVERS['std_redis']['host'], "port": settings.REDIS_SERVERS['std_redis']['port'], "db": settings.REDIS_SERVERS['std_redis']['db']}, ])
            rl = redis_lock.Lock(self, lockname, expire=locktime, auto_renewal=auto_renewal)
        except AssertionError:
            if self.logger:
                self.logger.error('Process {0} ({1}) could not get lock {2}. Going ahead without locking!!! {3}'.format(pid, caller, lockname, traceback.format_exc()))
            return False
        cont = 1
        t0 = time.time()
        lock = None
        while not lock:
            time.sleep(.05)
            cont += 1
            if cont % 20 == 0:
                if self.logger:
                    self.logger.debug('Process {0} ({1}) waiting for lock {2}. {3} seconds elapsed.'.format(pid, caller, lockname, time.time() - t0))
            # lock = rl.lock(lockname, locktime_ms)
            try:
                lock = rl.acquire()
            except RedisError:
                pass
        if self.logger:
            self.logger.debug('Process {0} ({1}) got lock {2} for {3} seconds'.format(pid, caller, lockname, locktime))
        return rl