How do you determine if a thread is running?
+2
A:
I think you can use GetState(); It can return the exact state of a thread.
Chathuranga Chandrasekara
2009-05-14 03:12:58
+5
A:
You can use this method:
boolean isAlive()
It returns true if the thread is still alive and false if the Thread is dead. This is not static. You need a reference to the object of the Thread class.
One more tip: If you're checking it's status to make the main thread wait while the new thread is still running, you may use join() method. It is more handy.
CodingTales
2009-05-14 03:21:22
+1
A:
Have your thread notify some other thread when it’s finished. This way you’ll always know exactly what’s going on.
Bombe
2009-05-14 07:03:34