diff --git a/cpu.cpp b/cpu.cpp index 02c4bfe..8d79475 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -278,7 +278,9 @@ bool cpu::check_queued_interrupts() return true; } } - + + any_queued_interrupts = false; + return false; } @@ -292,6 +294,8 @@ void cpu::queue_interrupt(const uint8_t level, const uint8_t vector) qi_cv.notify_all(); + any_queued_interrupts = true; + DOLOG(debug, true, "Queueing interrupt vector %o (IPL %d, current: %d), n: %zu", vector, level, getPSW_spl(), it->second.size()); } @@ -2159,8 +2163,8 @@ void cpu::step_a() if ((b->getMMR0() & 0160000) == 0) b->clearMMR1(); - if (check_queued_interrupts()) - return; + if (any_queued_interrupts && check_queued_interrupts()) + return; // documentation } void cpu::step_b() diff --git a/cpu.h b/cpu.h index d93e236..06208d6 100644 --- a/cpu.h +++ b/cpu.h @@ -43,6 +43,7 @@ private: std::map > queued_interrupts; std::mutex qi_lock; std::condition_variable qi_cv; + std::atomic_bool any_queued_interrupts { false }; std::set breakpoints;