1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-16 18:30:32 +00:00

Ensures that failure to allocate a line blocks all other allocations.

This commit is contained in:
Thomas Harte 2019-02-21 21:38:48 -05:00
parent ec14750ff1
commit c0c4704419
2 changed files with 5 additions and 2 deletions

View File

@ -234,7 +234,8 @@ void ScanTarget::submit() {
submit_pointers_.store(write_pointers_);
}
allocation_has_failed_ = false;
// Continue defaulting to a failed allocation for as long as there isn't a line available.
allocation_has_failed_ = line_allocation_has_failed_;
}
void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display::ScanTarget::Scan::EndPoint &location, uint8_t composite_amplitude) {
@ -267,9 +268,10 @@ void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display::
// Attempt to allocate a new line; note allocation failure if necessary.
const auto next_line = uint16_t((write_pointers_.line + 1) % LineBufferHeight);
if(next_line == read_pointers.line) {
allocation_has_failed_ = true;
line_allocation_has_failed_ = allocation_has_failed_ = true;
active_line_ = nullptr;
} else {
line_allocation_has_failed_ = false;
write_pointers_.line = next_line;
active_line_ = &line_buffer_[size_t(write_pointers_.line)];
}

View File

@ -172,6 +172,7 @@ class ScanTarget: public Outputs::Display::ScanTarget {
// Track allocation failures.
bool allocation_has_failed_ = false;
bool line_allocation_has_failed_ = false;
// Receives scan target modals.
Modals modals_;