Does not check locks.
516664
void remove_child(int idx)
    {
        assert(idx >=0);
        assert(idx < get_child_count()); // this also asserts child count > 0
        assert get_child(idx) != null : "No child at index " + idx;

        _children[idx].detachFromContainer();
        int children_to_move = _child_count - idx - 1;
        if (children_to_move > 0) {
            System.arraycopy(_children, idx+1, _children, idx, children_to_move);
        }
        _child_count--;
        _children[_child_count] = null;
        structuralModificationCount++;
    }
1006522
public synchronized void lockExclusive()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "lockExclusive", this);

        boolean interrupted = false;

        // If another thread is attempting to lock exclusive,
        // wait for it to finish first.
        while (!tryLockExclusive())
        {
            try
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Waiting to get exclusive lock");
                wait(1000);
            }
            catch (InterruptedException e)
            {
                // No FFDC code needed
                interrupted = true;
            }
        }

            // Wait for existing locks to be released
        while (iLockCount > 0)
        {
            try
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Waiting for lock count to reach 0 " + iLockCount);
                wait(1000);
            }
            catch (InterruptedException e)
            {
                // No FFDC code needed
                interrupted = true;
            }
        }

        if (interrupted)
        {
            Thread.currentThread().interrupt();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "lockExclusive");
    }
857708
def isKeyWriteLocked(self, keyID=None):
        
        kcfg = self.getKeyConfig(keyID)
        return 'writeLock' in kcfg and kcfg['writeLock'] is True
1173789
public final boolean tryLockForWrite(L locker) {
        int state = mState;
        if (state == 0) {
            // no locks are held
            if (isUpgradeOrReadWriteFirst() && setWriteLock(state)) {
                // keep upgrade state bit clear to indicate automatic upgrade
                mOwner = locker;
                incrementUpgradeCount();
                incrementWriteCount();
                return true;
            }
        } else if (state == LOCK_STATE_UPGRADE) {
            // only upgrade lock is held; upgrade to full write lock
            if (mOwner == locker && setWriteLock(state)) {
                incrementWriteCount();
                return true;
            }
        } else if (state < 0) {
            // write lock is held, and upgrade lock might be held too
            if (mOwner == locker) {
                incrementWriteCount();
                return true;
            }
        }
        return false;
    }
565930
public function lock() {
        $this->primaryPrivateKey = null;
        $this->secret = null;
        $this->primarySeed = null;
        $this->locked = true;
    }
245010
public synchronized boolean lock() throws KeeperException, InterruptedException {
        if (isClosed()) {
            return false;
        }
        ensurePathExists(dir);

        return (Boolean) retryOperation(zop);
    }
1239179
def unlock(self):
        """"""
        success = self.set_status(CONST.STATUS_LOCKOPEN_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_LOCKOPEN

        return success
241408
public boolean lockIfNotDisposed() {
    boolean result = false;
    if (this.panelLocker != null) {
      this.panelLocker.lock();
      if (this.disposed.get()) {
        this.panelLocker.unlock();
      } else {
        result = true;
      }
    }
    return result;
  }
533149
boolean isLocked(final DeviceProxy deviceProxy) throws DevFailed {
        final LockerInfo info = getLockerInfo(deviceProxy);
        return info.isLocked();
    }
353300
def remove_all_locks(self):
        """"""
        locks = list(self._locks.items())
        locks.sort(key=lambda l: l[1].get_last_access())
        for l in locks:
            self._remove_lock(l[0])
519832
function lock()
    {
        if ( $fp = $this->fp() )
        {
            if ( flock( $fp, LOCK_EX ) )
            {
                $this->clearMeta();
                $this->setMeta( 'timestamp', time() );
                return true;
            }
        }
        return false;
    }
486837
public function checkedLock()
    {
        $isLocked = ! flock($this->handle, LOCK_EX | LOCK_NB);
        if ($isLocked) {
            $this->lock();

        }
        return $isLocked;
    }
1215812
boolean isLocked(Path lockFile) throws JobLockException {
    try {
      return this.fs.exists(lockFile);
    } catch (IOException e) {
      throw new JobLockException(e);
    }
  }
743457
public static void assertUnlocked(Object object, String name) {
        if (RUNTIME_ASSERTIONS) {
            if (Thread.holdsLock(object)) {
                throw new RuntimeAssertion("Recursive lock of %s", name);
            }
        }
    }
301821
private synchronized final boolean isStateLocked()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(this, tc, "isStateLocked");
            SibTr.exit(this, tc, "isStateLocked", _itemLinkState);
        }
        if (_itemLinkState == ItemLinkState.STATE_LOCKED)
        {
            return true;
        }
        else
        {
            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
628110
def lock(self):
        
        if self.cache.get(self.lock_name):
            return False
        else:
            self.cache.set(self.lock_name, timezone.now(), self.timeout)
            return True