[*] Added locks to readdir. The MT variant got stuck on the todo list 2 years ago - still not done.

This commit is contained in:
Reece Wilson 2024-12-05 14:07:14 +00:00
parent 7e01c03fc5
commit a79e63375d
2 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,7 @@ namespace Aurora::IO::FS
AuString sPath;
AuUInt32 uErrorCount {};
AuList<AuString> errorPaths;
AuCriticalSection sect;
~ReadDirStructure()
{
@ -43,6 +44,8 @@ namespace Aurora::IO::FS
virtual AuList<AuString> GetErrorPaths() override
{
AU_LOCK_GUARD(this->sect);
if (this->uErrorCount)
{
return { this->sPath };
@ -56,6 +59,7 @@ namespace Aurora::IO::FS
virtual StatEx *Next() override
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->sect);
if (!AuExchange(this->bFirstTick, false))
{

View File

@ -62,6 +62,7 @@ namespace Aurora::IO::FS
AuString sPath;
bool bFast {};
AuUInt32 uErrorCount {};
AuCriticalSection sect;
~ReadDirStructure()
{
@ -78,6 +79,8 @@ namespace Aurora::IO::FS
virtual AuList<AuString> GetErrorPaths() override
{
AU_LOCK_GUARD(this->sect);
if (this->uErrorCount)
{
return { this->sPath };
@ -91,6 +94,7 @@ namespace Aurora::IO::FS
virtual StatEx *Next() override
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->sect);
bool bTryAgain {};