diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-15 10:51:03 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-15 10:51:03 +0000 |
commit | 8cd2b69b664959d90a882751caf724ad691307f3 (patch) | |
tree | fbeca219f3d3f70302078e554d4b758387c95516 /ext | |
parent | 9de707ad302fd045fb01b1f5d3680c3fc65b95dd (diff) |
merge revision(s) 15546:
* 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_6@17190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/readline/readline.c | 19 |
1 files changed, 17 insertions, 2 deletions
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) |