Used shared pointers and string streams to read data from the CEterPackManager

This commit is contained in:
2024-12-24 06:54:43 +02:00
parent 603f2207ef
commit c21c99393d
50 changed files with 363 additions and 3668 deletions

View File

@ -2,20 +2,18 @@
#define __INC_YMIR_ETERLIB_FILELOADERTHREAD_H__
#include <deque>
#include <memory>
#include <vector>
#include "Thread.h"
#include "Mutex.h"
#include "../eterBase/MappedFile.h"
class CFileLoaderThread
{
public:
typedef struct SData
{
std::string stFileName;
CMappedFile File;
LPVOID pvBuf;
DWORD dwSize;
std::string fileName;
std::shared_ptr<std::vector<char>> data;
} TData;
public:
@ -25,8 +23,8 @@ class CFileLoaderThread
int Create(void * arg);
public:
void Request(std::string & c_rstFileName);
bool Fetch(TData ** ppData);
void Request(const std::string& c_rstFileName);
bool Fetch(TData& data);
void Shutdown();
protected:
@ -49,10 +47,10 @@ class CFileLoaderThread
void Process();
private:
std::deque<TData *> m_pRequestDeque;
std::deque<TData> m_pRequestDeque;
Mutex m_RequestMutex;
std::deque<TData *> m_pCompleteDeque;
std::deque<TData> m_pCompleteDeque;
Mutex m_CompleteMutex;
HANDLE m_hSemaphore;