Mutex.LockError exception (Mutex v4.1.0)

Copy Markdown View Source

Reports a key that could not be locked.

This exception is returned by Mutex.lock/2 and raised by Mutex.lock!/2, Mutex.await/3, Mutex.await_all/2, Mutex.with_lock/4 and Mutex.with_lock_all/3.

The following fields are public:

  • :key - the key that could not be locked.
  • :cause - the reason why locking failed:
    • {:locked, owner_pid} - the key was locked by owner_pid when the mutex handled the request.
    • :self_deadlock - the calling process awaited a key that it already owns.

Summary

Types

The reason why a key could not be locked.

t()

Functions

Callback implementation for Exception.message/1.

Types

cause()

@type cause() :: {:locked, owner_pid :: pid()} | :self_deadlock

The reason why a key could not be locked.

t()

@type t() :: %Mutex.LockError{__exception__: term(), cause: cause(), key: Mutex.key()}

Functions

message(e)

Callback implementation for Exception.message/1.