forked from metin2/client
Used shared pointers and string streams to read data from the CEterPackManager
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user