mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 22:13:37 +00:00
CRITICAL_SECTION is reentrant; std::mutex is not. This caused deadlocks during world generation, post-processing, and saving.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#pragma once
|
|
#include <mutex>
|
|
#include "../../../Minecraft.World/Util/ProgressListener.h"
|
|
|
|
class ProgressRenderer : public ProgressListener {
|
|
public:
|
|
enum eProgressStringType {
|
|
eProgressStringType_ID,
|
|
eProgressStringType_String, // 4J-PB added for updating the bytes read
|
|
// on a save transfer
|
|
};
|
|
|
|
static std::recursive_mutex s_progress;
|
|
|
|
int getCurrentPercent();
|
|
int getCurrentTitle();
|
|
int getCurrentStatus();
|
|
std::wstring& getProgressString(void);
|
|
ProgressRenderer::eProgressStringType getType();
|
|
|
|
private:
|
|
int lastPercent;
|
|
|
|
private:
|
|
int status;
|
|
Minecraft* minecraft;
|
|
int title;
|
|
int64_t lastTime;
|
|
bool noAbort;
|
|
std::wstring m_wstrText;
|
|
eProgressStringType m_eType;
|
|
|
|
void setType(eProgressStringType eType);
|
|
|
|
public:
|
|
ProgressRenderer(Minecraft* minecraft);
|
|
virtual void progressStart(int title);
|
|
virtual void progressStartNoAbort(int string);
|
|
void _progressStart(int title);
|
|
virtual void progressStage(int status);
|
|
virtual void progressStage(std::wstring& wstrText);
|
|
virtual void progressStagePercentage(int i);
|
|
}; |