diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index 861bf8e9c4..5b8309e8b7 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -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; diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 5be3f73cb6..41b529cf64 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -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)); }