aboutsummaryrefslogtreecommitdiffstats
path: root/thread_win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-17 13:23:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-17 13:23:42 +0000
commite155302f3925ae7bc81a26d973beb2636541f666 (patch)
treee1a994114ec10b759f46f8b1bcbb75d095d031cb /thread_win32.c
parent8cad54a696cba1f2585cdca8d0f5e210d19e2662 (diff)
downloadruby-e155302f3925ae7bc81a26d973beb2636541f666.tar.gz
thread_win32.c: fix index
* thread_win32.c (w32_wait_events): fix wait object index in the case of interrupt_event is not usable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 3edb998695..da181f043e 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -163,6 +163,7 @@ w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th)
{
HANDLE *targets = events;
HANDLE intr;
+ const int initcount = count;
DWORD ret;
thread_debug(" w32_wait_events events:%p, count:%d, timeout:%ld, th:%p\n",
@@ -184,7 +185,7 @@ w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th)
ret = WaitForMultipleObjects(count, targets, FALSE, timeout);
thread_debug(" WaitForMultipleObjects end (ret: %lu)\n", ret);
- if (ret == (DWORD)(WAIT_OBJECT_0 + count - 1) && th) {
+ if (ret == (DWORD)(WAIT_OBJECT_0 + initcount) && th) {
errno = EINTR;
}
if (ret == WAIT_FAILED && THREAD_DEBUG) {