Make program_terminated flag atomic and volatile.