Make the Loader API thread-safe

Since the majority of the code is using ReadAt API already, map this to
a `readp` "syscall" which does not mutate any state about the file
descriptor therefore making it fairly safe multi-threading wise.

This allows to get rid of read-time mutexes in RamCachedFileLoader and
therefore fixes #9803
This commit is contained in:
Simonas Kazlauskas committed 2017-06-23 17:23:43 +03:00
1 parent 3249d81654
commit 3c3596dbf2
14 files changed
+7 -107

No files matched your search

-1
View File
@@ -38,7 +38,6 @@ BlockDevice *constructBlockDevice(FileLoader *fileLoader) {
return nullptr;
char buffer[4]{};
size_t size = fileLoader->ReadAt(0, 1, 4, buffer);
fileLoader->Seek(0);
if (size == 4 && !memcmp(buffer, "CISO", 4))
return new CISOFileBlockDevice(fileLoader);
else if (size == 4 && !memcmp(buffer, "\x00PBP", 4))