KLThread.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:1k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //---------------------------------------------------------------------------
  2. // Sword3 Engine (c) 1999-2000 by Kingsoft
  3. //
  4. // File: KLThread.h
  5. // Date: 2000.08.08
  6. // Code: Daniel Wang
  7. // Desc: Header File
  8. //---------------------------------------------------------------------------
  9. #ifndef __KThread_H__
  10. #define __KThread_H__
  11. //---------------------------------------------------------------------------
  12. typedef void (* TThreadFunc)(void* arg);
  13. //---------------------------------------------------------------------------
  14. class KLThread
  15. {
  16. private:
  17. HANDLE m_ThreadHandle;
  18. DWORD m_ThreadId;
  19. TThreadFunc  m_ThreadFunc;
  20. LPVOID m_ThreadParam;
  21. public:
  22. KLThread();
  23. ~KLThread();
  24. BOOL Create(TThreadFunc lpFunc, void* lpParam);
  25. void Destroy();
  26. void Suspend();
  27. void Resume();
  28. BOOL IsRunning();
  29. void WaitForExit();
  30. int GetPriority();
  31. BOOL SetPriority(int priority);
  32. private:
  33. DWORD ThreadFunction();
  34. static DWORD WINAPI ThreadProc(LPVOID lpParam);
  35. };
  36. //---------------------------------------------------------------------------
  37. #endif