diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-19 05:27:35 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-19 05:27:35 +0000 |
| commit | 0c2db26280eecfdb3de19c4294e3a655425b4833 (patch) | |
| tree | 4bf20d48b88b591c1efb3ebc3dea78ac4cbe9b70 | |
| parent | 9ffeef1fa60bf30e46665940e8ae93f9e787002a (diff) | |
| download | ruby-0c2db26280eecfdb3de19c4294e3a655425b4833.tar.gz ruby-0c2db26280eecfdb3de19c4294e3a655425b4833.tar.xz ruby-0c2db26280eecfdb3de19c4294e3a655425b4833.zip | |
* ext/readline/readline.c (readline_event): prevent polling. based on
a patch from error errorsson in [ruby-Bugs-17675].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | ext/readline/readline.c | 16 |
2 files changed, 19 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Tue Feb 19 14:27:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/readline/readline.c (readline_event): prevent polling. based on + a patch from error errorsson in [ruby-Bugs-17675]. + Tue Feb 19 11:14:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * eval.c (ruby_exec_node): no thread starts inside iseq compilation. diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 53d37a06a..ffa4a5dc7 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -43,16 +43,28 @@ static ID completion_proc, completion_case_fold; # define rl_completion_matches completion_matches #endif -static int readline_event(void); static char **readline_attempted_completion_function(const char *text, int start, int end); +#ifdef HAVE_RL_EVENT_HOOK +#define BUSY_WAIT 0 + +static int readline_event(void); static int -readline_event() +readline_event(void) { +#if BUSY_WAIT rb_thread_schedule(); +#else + fd_set rset; + + FD_ZERO(&rset); + FD_SET(fileno(rl_instream), &rset); + rb_thread_select(fileno(rl_instream) + 1, &rset, NULL, NULL, NULL); return 0; +#endif } +#endif static VALUE readline_readline(int argc, VALUE *argv, VALUE self) |
