diff options
Diffstat (limited to 'ext/readline')
-rw-r--r-- | ext/readline/readline.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 53d37a06aa..ffa4a5dc77 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) |