Mutex.ReleaseError exception (Mutex v4.1.0)

Copy Markdown View Source

Reports a lock that could not be released or given away.

This exception is returned by Mutex.release/2 and raised by Mutex.release!/2 and Mutex.give_away/4.

The following fields are public:

  • :key_or_keys - the key of a single lock, or the list of keys of a multilock.
  • :lock_type - :single or :multi.
  • :action - the attempted operation, :release or :give_away.
  • :releaser - the pid of the process that attempted the operation.
  • :cause - the reason why the operation failed:
    • :bad_owner - a key is locked by another process. The pid of that process is then set in the :owner field.
    • :unknown_key - a key is not locked in the mutex.
  • :owner - the pid of the process owning a key of the lock when the cause is :bad_owner, otherwise nil.

Summary

Functions

Callback implementation for Exception.message/1.

Types

t()

@type t() :: %Mutex.ReleaseError{
  __exception__: term(),
  action: :release | :give_away,
  cause: :bad_owner | :unknown_key,
  key_or_keys: Mutex.key() | [Mutex.key()],
  lock_type: :single | :multi,
  owner: pid() | nil,
  releaser: pid()
}

Functions

message(e)

Callback implementation for Exception.message/1.