Class Needle::QueryableMutex
In: lib/needle/thread.rb
Parent: Mutex

A subclass of Mutex that allows clients to discover which thread has the mutex locked. This is necessary for (among other things) discovering cycles in the dependency graph of services.

Methods

lock   new   self_locked?   try_lock   unlock  

Public Class methods

Create a new unlocked QueryableMutex.

Public Instance methods

Checks to see if the current thread has the mutex locked, and if it does, raises an exception. Otherwise, locks the mutex and sets the locking thread to Thread.current.

Return true if the current thread has locked this mutex.

Attempts to acquire the lock. Returns true if the lock was acquired, and false if the mutex was already locked.

Unlocks the mutex and sets the locking thread to nil.

[Validate]