How to check if threads still exist?
Hi.
I'm making a chatprogram, and the server creates a thread for each client connected. The server stores these threads in a vector. But how can I remove the thread out of the vector when the thread doesn't exists anymore (when the client has disconnected)?. I know the removeElement function, but how can I check whether the thread exists or not?
Thanks,
Niek
Re: How to check if threads still exist?
Weird approach. Well, if you want to check if the Thread is running use "Thread.isAlive()", to check if it exists at all just make sure it's not null, unless you're calling the .destroy method to terminate the thread then use "Thread.getState() == Thread.State.TERMINATED"