Detach the thread when it is sleeping on `select'