check to see if the thread is alive

Threads may be stopped because of thread.interrupt, so we need to check before going further to thread.join.