From 12549ff4121182784ede4f30cc973e44070ad7b0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 31 Dec 2016 11:48:46 -0500 Subject: [PATCH] Might as well get the file offset before entering the critical section; also moved the lock guard down more explicitly to group with the second set of actions. --- Storage/Disk/Formats/OricMFMDSK.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Storage/Disk/Formats/OricMFMDSK.cpp b/Storage/Disk/Formats/OricMFMDSK.cpp index c740e0f75..142a54fa5 100644 --- a/Storage/Disk/Formats/OricMFMDSK.cpp +++ b/Storage/Disk/Formats/OricMFMDSK.cpp @@ -135,9 +135,9 @@ void OricMFMDSK::store_updated_track_at_position(unsigned int head, unsigned int { Storage::Encodings::MFM::Parser parser(true, track); std::vector parsed_track = parser.get_track(0); - std::lock_guard lock_guard(file_access_mutex); - long file_offset = get_file_offset_for_position(head, position); + + std::lock_guard lock_guard(file_access_mutex); fseek(file_, file_offset, SEEK_SET); fwrite(parsed_track.data(), 1, parsed_track.size(), file_); }