Open kennytm opened 11 years ago
Agreed Kenny this is a great enhancement. Though you might have many different threads running/waiting simultaneously. I'm not sure there is a way to easily determine which thread is waiting because of and honest to $(deity) dataflow wait and a thread that is waiting because of a bug in the code. both waits are legitimate reactions.
There has to be some way to determine which threads are waiting. If we press Ctrl+C it'll just dump a list of threads and their wait times and maybe which variable they are waiting on. This way we will have at least a better way of knowing where the issue lies.
VM::aliveThreads contains a list of all alive threads. This includes threads that are waiting, as long as they are still alive.
A thread is dead if it waits on a variable that is not reachable anymore from the runnable threads or from IO operations. At the next GC, these threads will be GCed and hence will disappear from aliveThreads
.
This is mainly as a debugging aid. Currently when a program is stuck, there is no way to check why. In Python or Ruby, we could Ctrl+C to kill the program and the VM will print the current stack trace before the KeyboardInterrupt.
(Having a proper debugger is of course more welcome.)