IT lexicon › Programming › Timeout lock

Timeout lock

Programming På svenska → Updated: 2026-11-16

Lock mechanism that fails or wakes after a time limit instead of waiting indefinitely.

Many lock APIs offer try_lock_for(duration) or similar — an acquisition attempt that gives up after a timeout. This serves two purposes: deadlock detection (if the lock couldn't be acquired in 10 seconds, something is probably stuck) and deadlock recovery through timeout-based release-and-retry.

Timeout is not an elegant deadlock solution but is often practical for long-running systems where perfect deadlock prevention is too complex. It requires the application to handle timeouts, typically by logging and switching modes. Not suitable for systems where deadlock must never occur.

← Back to the lexicon