title: determine when a thread is waiting for a lock to release
body: <p>The lock mechanism (among others) exists to prevent access to shared resources at the same time by different threads. The thread that wants to use the resource is blocked, and must wait for lock to release in order to continue. (Correct me if I'm wrong)</p>
  
  <p>How can I tell when a thread is waiting for a lock to be released, and when not? In other words, how to know when a thread is blocked?.</p>
  
  <p>If this is possible, how can I tell how many times this occurs?</p>