bool State::process_async(CallFrame* call_frame) { set_call_frame(call_frame); vm_->clear_check_local_interrupts(); if(vm_->run_signals_) { if(!vm_->shared.signal_handler()->deliver_signals(this, call_frame)) { return false; } } Exception* exc = vm_->interrupted_exception_.get(); if(!exc->nil_p()) { vm_->interrupted_exception_.set(nil<Exception>()); // Only write the locations if there are none. if(exc->locations()->nil_p() || exc->locations()->size() == 0) { exc->locations(this, Location::from_call_stack(this, call_frame)); } vm_->thread_state_.raise_exception(exc); return false; } if(vm_->interrupt_by_kill()) { vm_->clear_interrupt_by_kill(); vm_->thread_state_.raise_thread_kill(); return false; } return true; }
bool VM::check_thread_raise_or_kill(STATE) { Exception* exc = interrupted_exception(); if(!exc->nil_p()) { clear_interrupted_exception(); // Only write the locations if there are none. if(exc->locations()->nil_p() || exc->locations()->size() == 0) { exc->locations(this, Location::from_call_stack(state)); } thread_state_.raise_exception(exc); return true; } if(interrupt_by_kill()) { Fiber* fib = current_fiber.get(); if(fib->nil_p() || fib->root_p()) { clear_interrupt_by_kill(); } else { set_check_local_interrupts(); } thread_state_.raise_thread_kill(); return true; } // If the current thread is trying to step, debugger wise, then assist! if(thread_step()) { clear_thread_step(); if(!Helpers::yield_debugger(state, cNil)) return true; } return false; }