Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: U P T H R E A D . H
  7. //
  8. // Contents: Threading support code
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 29 Sep 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class CWorkItem
  17. {
  18. public:
  19. CWorkItem();
  20. virtual ~CWorkItem();
  21. HRESULT HrStart(BOOL bDeleteOnComplete);
  22. protected:
  23. virtual DWORD DwRun() = 0;
  24. virtual ULONG GetFlags();
  25. private:
  26. CWorkItem(const CWorkItem &);
  27. CWorkItem & operator=(const CWorkItem &);
  28. BOOL m_bDeleteOnComplete;
  29. static DWORD WINAPI DwThreadProc(void * pvParam);
  30. };
  31. class CThreadBase
  32. {
  33. public:
  34. CThreadBase();
  35. virtual ~CThreadBase();
  36. HRESULT HrStart(BOOL bDeleteOnComplete, BOOL bCreateSuspended);
  37. HRESULT HrGetExitCodeThread(DWORD * pdwExitCode);
  38. HRESULT HrResumeThread();
  39. HRESULT HrSuspendThread();
  40. HANDLE GetThreadHandle();
  41. DWORD GetThreadId();
  42. HRESULT HrWait(DWORD dwTimeoutInMillis, BOOL * pbTimedOut);
  43. protected:
  44. virtual DWORD DwRun() = 0;
  45. private:
  46. CThreadBase(const CThreadBase &);
  47. CThreadBase & operator=(const CThreadBase &);
  48. HANDLE m_hThread;
  49. DWORD m_dwThreadId;
  50. BOOL m_bDeleteOnComplete;
  51. static DWORD WINAPI DwThreadProc(void * pvParam);
  52. };