Moving cancel_join_thred() toward the start of the processes.