1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef __EVENTPOOL_H__
- #define __EVENTPOOL_H__
- #include "Lock.h"
- typedef struct _SEvent* LPSEVENT;
- class CEventThread;
- class CEventQueue;
- class CEventPool
- {
- CEventPool();
- public:
- static CEventPool* GetInstance()
- {
- static CEventPool obj;
- return &obj;
- }
- ~CEventPool();
- // 添加任务事件
- int AddEvent(IN LPSEVENT lpEvent);
- // 取出任务
- LPSEVENT TakeOutEvent();
- // 删除事件
- void DeleteEvent();
- // 清除所有事件
- void ClearAllEvent();
- // 获取事件数量
- int GetEventNum();
- // 终止线程
- void Terminate();
- private:
- CEventThread* m_pThread;
- CEventQueue* m_pEventQueue;
- DWORD m_dwEventSize;
- CLock m_lock;
- };
- #endif //__EVENTPOOL_H__
|