move rb_thread_t::interrupt_flag and mask

to rb_execution_context_t.

* vm_core.h (rb_thread_t): move
  `rb_thread_t::interrupt_flag` and
  `rb_thread_t::interrupt_mask` to rb_execution_context_t.

  RUBY_VM_CHECK_INTS() accepts `ec` instead of `th`.

* cont.c (rb_fiber_terminate): to propagate interrupt information,
  add new parameter `need_interrupt`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-11-06 07:44:28 +00:00
parent 5845bd6a71
commit 5dfdaa9299
13 changed files with 117 additions and 111 deletions

View file

@ -167,7 +167,7 @@ w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th)
thread_debug(" w32_wait_events events:%p, count:%d, timeout:%ld, th:%p\n",
events, count, timeout, th);
if (th && (intr = th->native_thread_data.interrupt_event)) {
if (ResetEvent(intr) && (!RUBY_VM_INTERRUPTED(th) || SetEvent(intr))) {
if (ResetEvent(intr) && (!RUBY_VM_INTERRUPTED(th->ec) || SetEvent(intr))) {
targets = ALLOCA_N(HANDLE, count + 1);
memcpy(targets, events, sizeof(HANDLE) * count);
@ -285,7 +285,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv)
th->unblock.arg = th;
native_mutex_unlock(&th->interrupt_lock);
if (RUBY_VM_INTERRUPTED(th)) {
if (RUBY_VM_INTERRUPTED(th->ec)) {
/* interrupted. return immediate */
}
else {