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

ruby-changes:6552

From: usa <ko1@a...>
Date: Tue, 15 Jul 2008 18:14:35 +0900 (JST)
Subject: [ruby-changes:6552] Ruby:r18068 (trunk): * thread_win32.c (ubf_handle): cancel blocking IO if it can (only

usa	2008-07-15 18:14:09 +0900 (Tue, 15 Jul 2008)

  New Revision: 18068

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

  Log:
    * thread_win32.c (ubf_handle): cancel blocking IO if it can (only
      Vista). see [ruby-dev:35446]
    
    * win32/win32.c (errmap): add ERROR_OPERATION_ABORTED as EINTR.

  Modified files:
    trunk/ChangeLog
    trunk/thread_win32.c
    trunk/win32/win32.c

Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 18067)
+++ thread_win32.c	(revision 18068)
@@ -532,8 +532,19 @@
 static void
 ubf_handle(void *ptr)
 {
+    static int checked = 0;
+    typedef BOOL (WINAPI *cancel_io_func_t)(HANDLE);
+    static cancel_io_func_t cancel_func = NULL;
     rb_thread_t *th = (rb_thread_t *)ptr;
     thread_debug("ubf_handle: %p\n", th);
+
+    if (!checked) {
+	cancel_func = (cancel_io_func_t)GetProcAddress(GetModuleHandle("kernel32"), "CancelSynchronousIo");
+	checked = 1;
+    }
+    if (cancel_func)
+	cancel_func((HANDLE)th->thread_id);
+
     w32_set_event(th->native_thread_data.interrupt_event);
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18067)
+++ ChangeLog	(revision 18068)
@@ -1,3 +1,10 @@
+Tue Jul 15 18:12:02 2008  NAKAMURA Usaku  <usa@r...>
+
+	* thread_win32.c (ubf_handle): cancel blocking IO if it can (only
+	  Vista). see [ruby-dev:35446]
+
+	* win32/win32.c (errmap): add ERROR_OPERATION_ABORTED as EINTR.
+
 Mon Jul 14 20:35:21 2008  Masaki Suketa  <masaki.suketa@n...>
 
 	* test/win32ole/test_win32ole_event.rb (teardown): fix typo.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 18067)
+++ win32/win32.c	(revision 18068)
@@ -164,6 +164,7 @@
     {	ERROR_PIPE_BUSY,		EAGAIN		},
     {	ERROR_NO_DATA,			EPIPE		},
     {	ERROR_PIPE_NOT_CONNECTED,	EPIPE		},
+    {	ERROR_OPERATION_ABORTED,	EINTR		},
     {	ERROR_NOT_ENOUGH_QUOTA,		ENOMEM		},
     {	WSAENAMETOOLONG,		ENAMETOOLONG	},
     {	WSAENOTEMPTY,			ENOTEMPTY	},

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

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