mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-05 23:56:33 +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:
parent
6f0b5427e4
commit
12549ff412
@ -135,9 +135,9 @@ void OricMFMDSK::store_updated_track_at_position(unsigned int head, unsigned int
|
|||||||
{
|
{
|
||||||
Storage::Encodings::MFM::Parser parser(true, track);
|
Storage::Encodings::MFM::Parser parser(true, track);
|
||||||
std::vector<uint8_t> parsed_track = parser.get_track(0);
|
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);
|
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);
|
fseek(file_, file_offset, SEEK_SET);
|
||||||
fwrite(parsed_track.data(), 1, parsed_track.size(), file_);
|
fwrite(parsed_track.data(), 1, parsed_track.size(), file_);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user