[前][次][番号順一覧][スレッド一覧]

ruby-changes:24193

From: naruse <ko1@a...>
Date: Thu, 28 Jun 2012 17:58:36 +0900 (JST)
Subject: [ruby-changes:24193] naruse:r36244 (ruby_1_9_3): merge revision(s) 32549,32557: [Backport #6661]

naruse	2012-06-28 17:58:21 +0900 (Thu, 28 Jun 2012)

  New Revision: 36244

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36244

  Log:
    merge revision(s) 32549,32557: [Backport #6661]
    
    * win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
      from rb_w32_has_cancel_io().  now it takes a parameter as fd to check
      the fd is console or not, because we cannot cancel console input even
      if we have cancel_io function.
    
    * io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
      so now we can kill the thread which calls STDIN.gets.
      the problem was reported by ko1 vir IRC.
    
    * win32/win32.c (is_socket, is_console): add prototypes to fix compile
      problem with gcc introduced at r32549.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/include/ruby/win32.h
    branches/ruby_1_9_3/io.c
    branches/ruby_1_9_3/version.h
    branches/ruby_1_9_3/win32/win32.c

Index: ruby_1_9_3/include/ruby/win32.h
===================================================================
--- ruby_1_9_3/include/ruby/win32.h	(revision 36243)
+++ ruby_1_9_3/include/ruby/win32.h	(revision 36244)
@@ -233,7 +233,7 @@
 extern int    rb_w32_cmdvector(const char *, char ***);
 extern rb_pid_t  rb_w32_pipe_exec(const char *, const char *, int, int *, int *);
 extern int    flock(int fd, int oper);
-extern int    rb_w32_has_cancel_io(void);
+extern int    rb_w32_io_cancelable_p(int);
 extern int    rb_w32_is_socket(int);
 extern int    WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
 extern int    WSAAPI rb_w32_bind(int, const struct sockaddr *, int);
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 36243)
+++ ruby_1_9_3/ChangeLog	(revision 36244)
@@ -1,3 +1,8 @@
+Thu Jun 28 17:57:49 2012  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (is_socket, is_console): add prototypes to fix compile
+	  problem with gcc introduced at r32549.
+
 Wed Jun 27 08:31:50 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* insns.def (splatarray): make new array if flag is set.
Index: ruby_1_9_3/io.c
===================================================================
--- ruby_1_9_3/io.c	(revision 36243)
+++ ruby_1_9_3/io.c	(revision 36244)
@@ -193,7 +193,7 @@
 
 #if defined(_WIN32)
 #define WAIT_FD_IN_WIN32(fptr) \
-    (rb_w32_has_cancel_io() ? 0 : rb_thread_wait_fd((fptr)->fd))
+    (rb_w32_io_cancelable_p((fptr)->fd) ? 0 : rb_thread_wait_fd((fptr)->fd))
 #else
 #define WAIT_FD_IN_WIN32(fptr)
 #endif
Index: ruby_1_9_3/win32/win32.c
===================================================================
--- ruby_1_9_3/win32/win32.c	(revision 36243)
+++ ruby_1_9_3/win32/win32.c	(revision 36244)
@@ -578,12 +578,6 @@
 typedef BOOL (WINAPI *cancel_io_t)(HANDLE);
 static cancel_io_t cancel_io = NULL;
 
-int
-rb_w32_has_cancel_io(void)
-{
-    return cancel_io != NULL;
-}
-
 static void
 init_func(void)
 {
@@ -2088,6 +2082,15 @@
 #define FDEV			0x40	/* file handle refers to device */
 #define FTEXT			0x80	/* file handle is in text mode */
 
+static int is_socket(SOCKET);
+static int is_console(SOCKET);
+
+int
+rb_w32_io_cancelable_p(int fd)
+{
+    return cancel_io != NULL && (is_socket(TO_SOCKET(fd)) || !is_console(TO_SOCKET(fd)));
+}
+
 static int
 rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
 {
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 36243)
+++ ruby_1_9_3/version.h	(revision 36244)
@@ -1,10 +1,10 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 242
+#define RUBY_PATCHLEVEL 243
 
-#define RUBY_RELEASE_DATE "2012-06-27"
+#define RUBY_RELEASE_DATE "2012-06-28"
 #define RUBY_RELEASE_YEAR 2012
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 27
+#define RUBY_RELEASE_DAY 28
 
 #include "ruby/version.h"
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]