// Here, T1 is stuck behind T3, and T3 is waiting for T1,
// so we have a deadlock.
if ((index == (chain.size() - 1)) ||
((index == (chain.size() - 2))
&& (index == (chain.indexOf(grants) - 1)))) {
// The two identical compatibility spaces were right
// next to each other on the stack. This means we have
// the first scenario described above, with the first
// waiter already having a lock on the object. It is a