[runtime] Fix an infinite loop in the runtime class init code. (#4455)
The following can happen:
* Thread T1 starts initialization of C1
* Thread T2 starts initialization of C2
* T2 starts initialization of C1, it gets blocked on T1.
* T1 finishes initializing C1.
* T1 starts initialization of C3.
* T1 starts initialization of C2. It sees that T2 is
still blocked on T1, but its not actually blocked, since
C1 is finished. Still, we record that T1 is blocked.
* T3 starts initialization of C2, it gets into an infinite
loop in the while loop, since the blocked_thread_hash
now indicates that T1 and T2 are blocked on each other.
The solution is to not mark a thread as blocked, if its waiting
for a thread which is waiting on a finished lock. Fixes hangs
when running csc.