Corrected thread shutdown/wakeup.