Refactor old ContentLoadingManager into Content for simplicity

This commit is contained in:
Wojtek Figat
2024-10-11 23:05:09 +02:00
parent ff495e1319
commit f8371d037b
10 changed files with 314 additions and 439 deletions

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Threading/IRunnable.h"
/// <summary>
/// Resources loading thread.
/// </summary>
class LoadingThread : public IRunnable
{
protected:
volatile int64 _exitFlag;
Thread* _thread;
int32 _totalTasksDoneCount;
public:
LoadingThread();
~LoadingThread();
public:
/// <summary>
/// Set exit flag to true so thread must exit
/// </summary>
void NotifyExit();
/// <summary>
/// Stops the calling thread execution until the loading thread ends its execution.
/// </summary>
void Join();
/// <summary>
/// Starts thread execution.
/// </summary>
/// <param name="name">The thread name.</param>
/// <returns>True if cannot start, otherwise false</returns>
bool Start(const String& name);
/// <summary>
/// Runs the specified task.
/// </summary>
/// <param name="task">The task.</param>
void Run(class ContentLoadTask* task);
public:
// [IRunnable]
String ToString() const override;
int32 Run() override;
void Exit() override;
};