wait is called in the terminate. You can't wait on your own thread, you need to wait on the other thread. So that's why it's in the terminate()