6#include "HAL/ThreadSafeCounter.h"
7#include "Misc/ScopeLock.h"
8#include "HAL/DiskUtilizationTracker.h"
9#include "HAL/ThreadSafeCounter.h"
10#include "Misc/ScopeLock.h"
11#include "GenericPlatform/GenericPlatformFile.h"
12#include "HAL/PlatformProcess.h"
14#define MANAGE_FILE_HANDLES (#)
55 if (Handle !=
nullptr)
70 bool bWasOpen =
false;
139 FPlatformMisc::LowLevelOutputDebugString(
TEXT(
"Spinning because we are actively reading from more file handles than we have possible handles.\r\n"));
148 check(!Handle->PreviousLink && !Handle->NextLink && !Handle->bIsOpenAndAvailableForClosing);
153 check(!OpenAndAvailableForClosingTail->NextLink);
158 check(!OpenAndAvailableForClosingHead);
171 check(Handle->bIsOpenAndAvailableForClosing);
175 check(OpenAndAvailableForClosingHead && OpenAndAvailableForClosingHead != Handle && Handle->PreviousLink);
182 check(Handle->NextLink && Handle->PreviousLink);
195 check(!Result->PreviousLink);
196 check(Result->bIsOpenAndAvailableForClosing);
201 check(OpenAndAvailableForClosingTail == Result);
206 check(OpenAndAvailableForClosingHead->PreviousLink == Result);
FWindowsCriticalSection FCriticalSection
void UnLink(FRegisteredFileHandle *Handle)
void LinkToTail(FRegisteredFileHandle *Handle)
virtual void PlatformCloseFile(FRegisteredFileHandle *)=0
virtual bool PlatformReopenFile(FRegisteredFileHandle *)=0
FCriticalSection LockSection
FRegisteredFileHandle * InitialOpenFile(const TCHAR *Filename)
FFileHandleRegistry(int32 InMaxOpenHandles)
FThreadSafeCounter HandlesCurrentlyInUse
virtual ~FFileHandleRegistry()=default
FRegisteredFileHandle * OpenAndAvailableForClosingTail
void UnTrackAndCloseFile(FRegisteredFileHandle *Handle)
virtual FRegisteredFileHandle * PlatformInitialOpenFile(const TCHAR *Filename)=0
FRegisteredFileHandle * PopFromHead()
void TrackEndRead(FRegisteredFileHandle *Handle)
void TrackStartRead(FRegisteredFileHandle *Handle)
FRegisteredFileHandle * OpenAndAvailableForClosingHead
bool bIsOpenAndAvailableForClosing
FRegisteredFileHandle * PreviousLink
FRegisteredFileHandle * NextLink
UE_NODISCARD_CTOR FScopeLock(FCriticalSection *InSynchObject)