Re: [PATCH v2 08/25] Make input_fd be per UI

Pedro Alves
2016-05-06T11:53:42Z

On 03/22/2016 09:46 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> @@ -498,6 +504,10 @@ target_terminal_inferior (void)
>> void
>> target_terminal_ours (void)
>> {
>> + struct ui *ui = current_ui;
>> +
>> + add_file_handler (ui->input_fd, stdin_event_handler, ui);
>> +
>> if (terminal_state == terminal_is_ours)
>> return;
>
> We should call add_file_handler after the terminal_state check above.
>

We actually shouldn't, because terminal_state only refers to the
state of gdb's main tty state, while we still want to add/remove
the _current_ UI's input_fd from the event loop. I've added
comments in v3.

Note that I'm gradually bubbling up these input_fd calls from the
targets backends towards common code. At some point I'd like to
migrate them somewhere even higher, maybe merged with
async_disable_stdin / async_enable_stdin, now that since the ctrl-c
rework series we only call target_terminal_ours when we really need
input. But that'll be yet another set of
cleaning-up-all-over-the-tree that I'd much rather not do
along with this series.

Thanks,
Pedro Alves