aboutsummaryrefslogtreecommitdiffstats
path: root/thread_win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-24 07:05:49 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-24 07:05:49 +0000
commitf92478c0fb900491deb35c7bad7cd6c6ac1e9f8c (patch)
treef9a829e2bd6686f6fc6cf0b08bbf6f7e025b1eda /thread_win32.c
parentf8f7f884c1ee39359fac439023322840ad564501 (diff)
downloadruby-f92478c0fb900491deb35c7bad7cd6c6ac1e9f8c.tar.gz
* win32/win32.c (overlapped_socket_io): avoid warnings.
* thread_win32.c (ubf_handle): refactoring. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 68d993a0b2..9241d274b0 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -519,17 +519,17 @@ 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) {
+ if (!cancel_func) {
cancel_func = (cancel_io_func_t)GetProcAddress(GetModuleHandle("kernel32"), "CancelSynchronousIo");
- checked = 1;
+ if (!cancel_func)
+ cancel_func = (cancel_io_func_t)-1;
}
- if (cancel_func)
+ if (cancel_func != (cancel_io_func_t)-1)
cancel_func((HANDLE)th->thread_id);
w32_set_event(th->native_thread_data.interrupt_event);