and target_terminal_inferior until we are sure that the inferior has called gdb_setpgid. This fixes PR 2900 (Schauer tracked it down and was able to reliably reproduce it by putting a sleep() before the gdb_setpgid()).