public synchronized boolean createLock(int timeout, boolean hold) {

		synchronized (waitLock) {

			// Renew lock if we already have it
			if (lockCount != 0 && renewLock()) {
				++lockCount;
				Msg.trace(this, "increased lock count (" + lockCount + "): " + getLockID());
				if (hold)
					holdLock(true);
				return true;
			}

			// Check if we can get lock immediately	
			try {
				if (createLockFileNoWait(true)) {
					if (waitTask != null) {
						waitTask.abort = true;
					}
					++lockCount;
					Msg.trace(this, "increased lock count (" + lockCount + "): " + getLockID());
					if (hold)
						holdLock(true);
					return true;
				}
			}
			catch (IOException e) {
				Msg.showError(this, null, "Lock Failure", "Unable to write to lock file: " +
					lockFile.getAbsolutePath(), e);
				return false;
			}

			Msg.trace(this, "wait for lock...: " + getLockID());

			// Start lock wait/cleanup task	
			startWaitTimer(timeout != 0);

			if (timeout == 0)
				return false;
		}

		// Wait for waitTask 
		if (waitTask != null && timeout > 0) {
			synchronized (waitTask) {
				try {
					waitTask.wait(timeout);
				}
				catch (InterruptedException e) {
					return false;
				}
			}
		}

		synchronized (waitLock) {

			// Don't create lock if we timed-out
			if (waitTask != null) {
				synchronized (waitTask) {
					waitTask.create = false;
				}
			}

			// Hold lock if requested
			if (lockCount != 0) {
				if (hold)
					holdLock(true);
				return true;
			}

			Msg.trace(this, "failed to obtain lock...: " + getLockID());

			return false;
		}
	}
Create the lock file.
If another lock file already exists, wait for it to expire
within the specified timeout period.  Method will block
until either the lock is obtained or the timeout period lapses.
@param timeout maximum time in milliseconds to wait for lock.  
@param hold if true the lock will be held and maintained until
removed, otherwise it is only guaranteed for MAX_LOCK_LEASE_PERIOD seconds.
@return true if lock creation was successful.
Ghidra/Framework/FileSystem/src/main/java/ghidra/framework/store/local/LockFile.java