diff options
Diffstat (limited to 'source/libs/asura-lib-utils/io/file.cpp')
-rw-r--r-- | source/libs/asura-lib-utils/io/file.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/libs/asura-lib-utils/io/file.cpp b/source/libs/asura-lib-utils/io/file.cpp index 976203d..0ff8c90 100644 --- a/source/libs/asura-lib-utils/io/file.cpp +++ b/source/libs/asura-lib-utils/io/file.cpp @@ -134,7 +134,10 @@ namespace AsuraEngine if (length < 0) throw Exception("Invalid read size."); - return PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + dst->Lock(); + size_t size = PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + dst->Unlock(); + return size; } size_t File::ReadAll(ASURA_OUT DataBuffer* dst) @@ -149,7 +152,10 @@ namespace AsuraEngine if (dst->GetSize() < length) throw Exception("Data buffer is too small compares to file length."); - return PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + dst->Lock(); + size_t size = PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + dst->Unlock(); + return size; } #ifdef ASURA_WINDOWS |