1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

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.

This commit is contained in:
Thomas Harte 2016-12-31 11:48:46 -05:00
parent 6f0b5427e4
commit 12549ff412

View File

@ -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<uint8_t> parsed_track = parser.get_track(0);
std::lock_guard<std::mutex> lock_guard(file_access_mutex);
long file_offset = get_file_offset_for_position(head, position);
std::lock_guard<std::mutex> lock_guard(file_access_mutex);
fseek(file_, file_offset, SEEK_SET);
fwrite(parsed_track.data(), 1, parsed_track.size(), file_);
}