detach thread in Thread::dtor() to prevent leaking.