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