summaryrefslogtreecommitdiffstats
path: root/thread_win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-15 09:14:09 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-15 09:14:09 +0000
commit37a4aa21c56148e80442b262b3a394fadcedd0dc (patch)
tree2603a4f1346f664bf7908df25ea51aed8d3ba834 /thread_win32.c
parente72f22f530e202f9e10e23a4c2355e5ea16cdb16 (diff)
downloadruby-37a4aa21c56148e80442b262b3a394fadcedd0dc.tar.gz
ruby-37a4aa21c56148e80442b262b3a394fadcedd0dc.tar.xz
ruby-37a4aa21c56148e80442b262b3a394fadcedd0dc.zip
* 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. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thread_win32.c b/thread_win32.c
index a810fb362..7c31a3f70 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -532,8 +532,19 @@ native_thread_apply_priority(rb_thread_t *th)
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);
}