diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2006-03-21 13:27:51 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2006-03-21 13:27:51 +0000 |
commit | 9ed873ed94b93ab1706f63f07e7ca971f81773b4 (patch) | |
tree | e98aa8c5cfd76999d46335d5230368df020a3a40 /src | |
parent | 27fd4beca7b46c87cd77c7ba5a9c9382a7bca8eb (diff) | |
download | weechat-9ed873ed94b93ab1706f63f07e7ca971f81773b4.zip |
Fixed high CPU usage when running under a screen that has been killed
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/curses/gui-input.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c index 225058c25..cd4215629 100644 --- a/src/gui/curses/gui-input.c +++ b/src/gui/curses/gui-input.c @@ -317,7 +317,7 @@ gui_main_loop () char text_time[1024]; time_t new_time; struct tm *local_time; - + quit_weechat = 0; new_time = time (NULL); @@ -397,14 +397,31 @@ gui_main_loop () plugin_timer_handler_exec (); } + /* read keyboard */ + FD_ZERO (&read_fd); + timeout.tv_sec = 0; + timeout.tv_usec = 8000; FD_SET (STDIN_FILENO, &read_fd); - if (weechat_fifo != -1) - FD_SET (weechat_fifo, &read_fd); + + if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0) + { + if (FD_ISSET (STDIN_FILENO, &read_fd)) + { + gui_input_read (); + } + } + + /* read sockets (servers, child process when connecting, FIFO pipe) */ + + FD_ZERO (&read_fd); timeout.tv_sec = 0; - timeout.tv_usec = 10000; + timeout.tv_usec = 2000; + + if (weechat_fifo != -1) + FD_SET (weechat_fifo, &read_fd); for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) @@ -456,10 +473,6 @@ gui_main_loop () if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0) { - if (FD_ISSET (STDIN_FILENO, &read_fd)) - { - gui_input_read (); - } if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd))) { fifo_read (); |