indexalloctor.h
来自「网络socket,IO,线程池」· C头文件 代码 · 共 34 行
H
34 行
#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 + =
减小字号Ctrl + -
显示快捷键?