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 | 27b302811d1d672f4667aa84f82a7fe25cdca7e9 (patch) | |
tree | dd0a8f6e56783dc039e31d9933a4a817b82a105c | |
parent | 3e877fa51b57695210753d3ace361377c11a3905 (diff) |
* ext/readline/readline.c (readline_event): prevent polling. based on
a patch from error errorsson in [ruby-Bugs-17675].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/readline/readline.c | 19 |
2 files changed, 22 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 12:08:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * parse.y (yycompile): clear ruby_eval_tree_begin if parse failed. diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 559e1c677b..82ddc8a3cb 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -42,17 +42,32 @@ 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 +#ifdef DOSISH +#define BUSY_WAIT 1 +#else +#define BUSY_WAIT 0 +#endif + +static int readline_event(void); static int readline_event() { - CHECK_INTS; +#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(argc, argv, self) |