arwinmemorypool_t.h

来自「wangchuanDll.rar 网络传输的DLL 源代码」· C头文件 代码 · 共 52 行

H
52
字号
// ArWinMemoryPool_T.h: interface for the ArWinMemoryPool_T class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ARWINMEMORYPOOL_T_H__E6885609_9DA7_44AE_BC2B_9DDB31BC7FCA__INCLUDED_)
#define AFX_ARWINMEMORYPOOL_T_H__E6885609_9DA7_44AE_BC2B_9DDB31BC7FCA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ArMemoryPool_T.h"
#include "ArMemoryList_T.h"
#include <map>

//----------------------------------------------------------------------------

class ArWinMemoryPool_T : public ArMemoryPool_T  
{
public:
	struct ArMemSet_T
	{
		int iMemSize;
		int iInitialNum;
	};
	void*   __stdcall Allocate(int iSize);	
	bool    __stdcall Free(void* pData);
    bool    __stdcall GetPoolInfo(ArMemoryPoolInfo_T& Info);
	bool    __stdcall Destroy();

	ArWinMemoryPool_T(int iListNum = 4);
    ~ArWinMemoryPool_T();
private:

    enum {MAXLISTNUM = 10};
	ArMemoryList_T*		m_MemList[MAXLISTNUM];
	ArMemSet_T			m_MemSet[MAXLISTNUM];
    int  m_iListNum;
    std::map<void*, ArBlockInfo_T>  m_MemTable;
    HANDLE              m_Event;
    CRITICAL_SECTION    m_csPoolAllocate;
	CRITICAL_SECTION	m_csPoolFree;


	bool FindRange(int iSize, int& index);
    bool IsAllMemoryFree(void);

    static  unsigned int  __stdcall  DestroyObj(void* pParent);
};

#endif // !defined(AFX_ARWINMEMORYPOOL_T_H__E6885609_9DA7_44AE_BC2B_9DDB31BC7FCA__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?