13
0

add memory fences to try to avoid a conceptual memory ordering issue between capture & the butler

This commit is contained in:
Paul Davis 2023-02-23 16:13:16 -07:00
parent 4137271188
commit 5c69aef56e
2 changed files with 7 additions and 0 deletions

View File

@ -213,6 +213,9 @@ Butler::thread_work ()
Temporal::TempoMap::fetch ();
restart:
/* Ensure that no reads migrate before this fence */
std::atomic_thread_fence (std::memory_order_acquire);
DEBUG_TRACE (DEBUG::Butler, "at restart for disk work\n");
disk_work_outstanding = false;

View File

@ -737,6 +737,10 @@ DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
_need_butler = true;
}
/* Ensure that anything written during run() is visible in other threads */
std::atomic_thread_fence (std::memory_order_release);
// DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 writer run, needs butler = %2\n", name(), _need_butler));
}