zsim
zsim copied to clipboard
avoid sleeping-relted deadlock (Issue #231)
Previous ThreadFini() lacks control of SLEEPING threads in finish(). This change helps many-thread simulation to completion; Otherwise, it deadlocks when running TailBench Apps with only 2-4 threads.
I think this fix is correct. Please also clean up the print message and debug notes in the code. Also, it seems you do not need to actually schedule it after you remove it from the sleep queue. It is finishing any way. Simply mark it as BLOCKED and leave it to the later code to deal with.