File lock = new File(customProfileDir(), "parent.lock");
for (long start = System.currentTimeMillis(); System.currentTimeMillis() < start + timeout;) {
AsyncExecute.sleepTight(500);
if (!lock.exists() && makeSureFileLockRemainsGone(lock, timeToWait)) return;
}
if (lock.exists()) throw new FileLockRemainedException("Lock file still present! " + lock.getAbsolutePath());
}