summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 13:02:12 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-22 13:02:12 +0000
commit398581564d155cab50beeb28fbb61fcbb5f4da16 (patch)
treea8edc2d945c9c7bade12ee941cb929fd20d412fd /io.c
parentc0a50272354ee03a4dbc7c518d5719a4f95b00d3 (diff)
* io.c (rb_io_wait_writable): use rb_thread_check_ints() instead
of rb_thread_fd_writable(). * io.c (rb_io_wait_readable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/io.c b/io.c
index 25680cf83e..9d124c00e9 100644
--- a/io.c
+++ b/io.c
@@ -1050,6 +1050,9 @@ rb_io_wait_readable(int f)
#if defined(ERESTART)
case ERESTART:
#endif
+ rb_thread_check_ints();
+ return TRUE;
+
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
@@ -1073,6 +1076,18 @@ rb_io_wait_writable(int f)
#if defined(ERESTART)
case ERESTART:
#endif
+ /*
+ * In old Linux, several special files under /proc and /sys don't handle
+ * select properly. Thus we need avoid to call if don't use O_NONBLOCK.
+ * Otherwise, we face nasty hang up. Sigh.
+ * e.g. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31b07093c44a7a442394d44423e21d783f5523b8
+ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31b07093c44a7a442394d44423e21d783f5523b8
+ * In EINTR case, we only need to call RUBY_VM_CHECK_INTS_BLOCKING().
+ * Then rb_thread_check_ints() is enough.
+ */
+ rb_thread_check_ints();
+ return TRUE;
+
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK: