WorkThreadPool.h
资源名称:1731.rar [点击查看]
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:1k
源码类别:
游戏
开发平台:
Visual C++
- // WorkThreadPool.h: interface for the CWorkThreadPool class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_WORKTHREADPOOL_H__30AF8906_EE6D_4FAD_B0F3_5F4F8AEFB15E__INCLUDED_)
- #define AFX_WORKTHREADPOOL_H__30AF8906_EE6D_4FAD_B0F3_5F4F8AEFB15E__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "threadpoolmodel.h"
- class CWorkThreadPool:public CThreadPoolModel
- {
- public:
- void SetThreadNum(int num = 3);
- void Stop();
- void SetPF(lpCallBack1 *f);
- void RegisterWorkItem(LPVOID item);
- int Run();
- CWorkThreadPool();
- virtual ~CWorkThreadPool();
- private:
- static UINT WORK(LPVOID lp);
- void RemoveWorkItem(LPVOID _pItem);
- UINT Work();
- LPVOID GetNextItem();
- CEvent m_exit;
- CCriticalSection m_lock;
- CEvent m_signal;
- CPtrArray m_workItems;
- lpCallBack1 *pf;
- int m_threadNum;
- inline HANDLE GetWorkEvent(void)
- {return m_signal.m_hObject;}
- };
- #endif // !defined(AFX_WORKTHREADPOOL_H__30AF8906_EE6D_4FAD_B0F3_5F4F8AEFB15E__INCLUDED_)