Mercurial > octave-libtiff
changeset 29293:8784f20b9b8c
new interpreter_event to signal that interpreter was interrupted
* event-manager.h (interpreter_events::interpreter_interrupted):
New virtual function.
(event_manager::interpreter_interrupted): New function.
* interpreter.cc (interpreter::recover_from_exception): Call
event_manager::interpreter_interrupted if octave_interrupt_state is set.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 14 Jan 2021 01:08:40 -0500 |
parents | eb1e10abe9d5 |
children | 6867e1e12815 |
files | libinterp/corefcn/event-manager.h libinterp/corefcn/interpreter.cc |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/event-manager.h Tue Jan 12 21:01:42 2021 -0500 +++ b/libinterp/corefcn/event-manager.h Thu Jan 14 01:08:40 2021 -0500 @@ -248,6 +248,8 @@ update_breakpoint (bool /*insert*/, const std::string& /*file*/, int /*line*/, const std::string& /*cond*/) { } + + virtual void interpreter_interrupted (void) { } }; //! Provides threadsafe access to octave. @@ -633,6 +635,12 @@ instance->update_breakpoint (insert, file, line, cond); } + void interpreter_interrupted (void) + { + if (enabled ()) + instance->interpreter_interrupted (); + } + private: interpreter& m_interpreter;
--- a/libinterp/corefcn/interpreter.cc Tue Jan 12 21:01:42 2021 -0500 +++ b/libinterp/corefcn/interpreter.cc Thu Jan 14 01:08:40 2021 -0500 @@ -1746,6 +1746,9 @@ void interpreter::recover_from_exception (void) { + if (octave_interrupt_state) + m_event_manager.interpreter_interrupted (); + can_interrupt = true; octave_interrupt_state = 0; octave_signal_caught = 0;