ruby-changes:26504
From: kosaki <ko1@a...>
Date: Sat, 22 Dec 2012 22:02:26 +0900 (JST)
Subject: [ruby-changes:26504] kosaki:r38555 (trunk): * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead
kosaki 2012-12-22 22:02:12 +0900 (Sat, 22 Dec 2012) New Revision: 38555 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38555 Log: * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead of rb_thread_fd_writable(). * io.c (rb_io_wait_readable): ditto. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38554) +++ ChangeLog (revision 38555) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 22 21:47:55 2012 KOSAKI Motohiro <kosaki.motohiro@g...> + + * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead + of rb_thread_fd_writable(). + * io.c (rb_io_wait_readable): ditto. + Sat Dec 22 20:31:10 2012 Nobuyoshi Nakada <nobu@r...> * object.c (rb_mod_const_get): symbol cannot be nested constant name. Index: io.c =================================================================== --- io.c (revision 38554) +++ io.c (revision 38555) @@ -1050,6 +1050,9 @@ rb_io_wait_readable(int f) https://github.com/ruby/ruby/blob/trunk/io.c#L1050 #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) https://github.com/ruby/ruby/blob/trunk/io.c#L1076 #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: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/