static bool unlockIfHolding(Lock lock) { if (lock == null || !hasLock(lock)) false; unlock(lock); true; }