ruby-changes:4056
From: ko1@a...
Date: Tue, 19 Feb 2008 14:28:00 +0900 (JST)
Subject: [ruby-changes:4056] nobu - Ruby:r15546 (ruby_1_8, trunk): * ext/readline/readline.c (readline_event): prevent polling. based on
nobu 2008-02-19 14:27:35 +0900 (Tue, 19 Feb 2008)
New Revision: 15546
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/ext/readline/readline.c
trunk/ChangeLog
trunk/ext/readline/readline.c
Log:
* ext/readline/readline.c (readline_event): prevent polling. based on
a patch from error errorsson in [ruby-Bugs-17675].
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=15546&r2=15545&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15546&r2=15545&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/readline/readline.c?r1=15546&r2=15545&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/readline/readline.c?r1=15546&r2=15545&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15545)
+++ ChangeLog (revision 15546)
@@ -1,3 +1,8 @@
+Tue Feb 19 14:27:32 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * 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@r...>
* eval.c (ruby_exec_node): no thread starts inside iseq compilation.
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c (revision 15545)
+++ ext/readline/readline.c (revision 15546)
@@ -43,16 +43,28 @@
# 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)
Index: ruby_1_8/ext/readline/readline.c
===================================================================
--- ruby_1_8/ext/readline/readline.c (revision 15545)
+++ ruby_1_8/ext/readline/readline.c (revision 15546)
@@ -42,17 +42,32 @@
# 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)
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 15545)
+++ ruby_1_8/ChangeLog (revision 15546)
@@ -1,3 +1,8 @@
+Tue Feb 19 14:27:32 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * 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@r...>
* parse.y (yycompile): clear ruby_eval_tree_begin if parse failed.
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/