⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indexalloctor.h

📁 网络socket,IO,线程池
💻 H
字号:
#ifndef _MINDEXALLOCTOR_ZHY_H
#define _MINDEXALLOCTOR_ZHY_H

#include "../Synchronization/Lock.h"
using namespace Synchronization;

#include <vector>
using namespace std;

class IndexAlloctor
{
public:
	IndexAlloctor(int nTotalSize = 1000);
	
	int AllocIndex();
	void DeAllocIndex(int nIndex);

private:
	inline int GetFreeIndex();

	int	m_nTotalSize;
	int	m_nFree;
	int m_nFreeCount;
	int m_bLockAll;
	vector<int> m_vIndex;
	CCriSection	m_CriLock; // 访问任务队列时互斥

	IndexAlloctor(const IndexAlloctor&);
	IndexAlloctor& operator= (const IndexAlloctor&);
};



#endif

⌨️ 快捷键说明

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