Skip to content

Commit

Permalink
Fixed interrupting Thread with active Fiber.
Browse files Browse the repository at this point in the history
brixen committed Jun 18, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 36b5013 commit 5b4b7c0
Showing 3 changed files with 9 additions and 17 deletions.
3 changes: 2 additions & 1 deletion machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
#include "on_stack.hpp"
#include "memory.hpp"
#include "metrics.hpp"
#include "raise_reason.hpp"
#include "thread_phase.hpp"

#include "builtin/array.hpp"
@@ -98,7 +99,7 @@ namespace rubinius {
}

Object* Fiber::return_value(STATE) {
if(vm()->thread_state()->current_exception()->nil_p()) {
if(vm()->thread_state()->raise_reason() == cNone) {
return value();
} else {
invoke_context()->thread_state()->set_state(vm()->thread_state());
12 changes: 6 additions & 6 deletions machine/builtin/thread.cpp
Original file line number Diff line number Diff line change
@@ -440,8 +440,8 @@ namespace rubinius {

if(!vm()) return cNil;

vm()->register_raise(state, exc);
vm()->wakeup(state);
vm()->current_fiber()->register_kill(state);
vm()->current_fiber()->wakeup(state);

return exc;
}
@@ -452,11 +452,11 @@ namespace rubinius {
if(!vm()) return cNil;

if(state->vm()->thread() == this) {
vm()->thread_state_.raise_thread_kill();
vm()->current_fiber()->thread_state()->raise_thread_kill();
return NULL;
} else {
vm()->register_kill(state);
vm()->wakeup(state);
vm()->current_fiber()->register_kill(state);
vm()->current_fiber()->wakeup(state);
return this;
}
}
@@ -468,7 +468,7 @@ namespace rubinius {
return force_as<Thread>(Primitives::failure());
}

vm()->wakeup(state);
vm()->current_fiber()->wakeup(state);

return this;
}
11 changes: 1 addition & 10 deletions machine/vm.cpp
Original file line number Diff line number Diff line change
@@ -178,16 +178,7 @@ namespace rubinius {
}

if(interrupt_by_kill()) {
/* TODO: Fiber
Fiber* fib = current_fiber.get();
if(fib->nil_p() || fib->root_p()) {
clear_interrupt_by_kill();
} else {
set_check_local_interrupts();
}
*/

set_check_local_interrupts();
thread_state_.raise_thread_kill();

return true;

0 comments on commit 5b4b7c0

Please sign in to comment.