1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Restore valid buffering.

This commit is contained in:
Thomas Harte 2020-11-21 22:55:54 -05:00
parent 3b2ea37428
commit dd816c5a0a

View File

@ -93,11 +93,12 @@ template <typename DataUnit> void BufferingScanTarget::end_data(size_t actual_le
// Acquire the producer lock.
std::lock_guard lock_guard(producer_mutex_);
// Record that no further end_data calls are expected.
// Do nothing if no data write is actually ongoing.
if(!data_is_allocated_) return;
data_is_allocated_ = false;
// Do nothing if no data write is actually ongoing.
if(allocation_has_failed_ || !data_is_allocated_) return;
// Check for other allocation failures.
if(allocation_has_failed_) return;
// Bookend the start and end of the new data, to safeguard for precision errors in sampling.
DataUnit *const sized_write_area = &reinterpret_cast<DataUnit *>(write_area_)[write_pointers_.write_area];