move kill_threads out of private block