state package:concurrent-extra

Determine the state of the reentrant lock. Note that this is only a snapshot of the state. By the time a program reacts on its result it may already be out of date.
The state of an RLock.
  • Nothing indicates an "unlocked" state.
  • Just (tid, n) indicates a "locked" state where the thread identified by tid acquired the lock n times.