Skip to content

Commit

Permalink
* thread_win32.c (rb_w32_wait_events_blocking): use
Browse files Browse the repository at this point in the history
  ruby_thread_from_native() instead of GET_THREAD() because
  GET_THREAD() doesn't always return the current thread and
  WaitForMultipleObjects() at rb_w32_read() doesn't return by
  Thread#kill. This fixes TestQueue#test_thr_kill failure on
  Windows.

* thread_win32.c (rb_w32_wait_events): use ruby_thread_from_native()
  instead of GET_THREAD() for consistency with the above change.

* thread_win32.c (rb_w32_sleep): ditto.

* thread_win32.c (rb_w32_Sleep): ditto.
  [ruby-dev:45149] [Bug ruby#5812]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shirosaki committed Jan 28, 2012
1 parent 11de7c0 commit 494fd23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Sat Jan 28 07:46:03 2012 Hiroshi Shirosaki <[email protected]>

* thread_win32.c (rb_w32_wait_events_blocking): use
ruby_thread_from_native() instead of GET_THREAD() because
GET_THREAD() doesn't always return the current thread and
WaitForMultipleObjects() at rb_w32_read() doesn't return by
Thread#kill. This fixes TestQueue#test_thr_kill failure on
Windows.

* thread_win32.c (rb_w32_wait_events): use ruby_thread_from_native()
instead of GET_THREAD() for consistency with the above change.

* thread_win32.c (rb_w32_sleep): ditto.

* thread_win32.c (rb_w32_Sleep): ditto.
[ruby-dev:45149] [Bug #5812]

Sat Jan 28 07:28:48 2012 Hiroshi Shirosaki <[email protected]>

* test/zlib/test_zlib.rb (TestZlibGzipReader#test_reader_wrap): set
Expand Down
8 changes: 4 additions & 4 deletions thread_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static void ubf_handle(void *ptr);
int
rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout)
{
return w32_wait_events(events, num, timeout, GET_THREAD());
return w32_wait_events(events, num, timeout, ruby_thread_from_native());
}

int
Expand All @@ -240,7 +240,7 @@ rb_w32_wait_events(HANDLE *events, int num, DWORD timeout)
int ret;

BLOCKING_REGION(ret = rb_w32_wait_events_blocking(events, num, timeout),
ubf_handle, GET_THREAD());
ubf_handle, ruby_thread_from_native());
return ret;
}

Expand Down Expand Up @@ -285,7 +285,7 @@ w32_create_thread(DWORD stack_size, w32_thread_start_func func, void *val)
int
rb_w32_sleep(unsigned long msec)
{
return w32_wait_events(0, 0, msec, GET_THREAD());
return w32_wait_events(0, 0, msec, ruby_thread_from_native());
}

int WINAPI
Expand All @@ -294,7 +294,7 @@ rb_w32_Sleep(unsigned long msec)
int ret;

BLOCKING_REGION(ret = rb_w32_sleep(msec),
ubf_handle, GET_THREAD());
ubf_handle, ruby_thread_from_native());
return ret;
}

Expand Down

0 comments on commit 494fd23

Please sign in to comment.