Improve thread reap handling