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.

45 lines
1.3 KiB

  1. #ifndef _RUNTASK_H_
  2. #define _RUNTASK_H_
  3. class CRunnableTask : public IRunnableTask
  4. {
  5. public:
  6. // *** IUnknown ***
  7. virtual STDMETHODIMP_(ULONG) AddRef(void);
  8. virtual STDMETHODIMP_(ULONG) Release(void);
  9. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  10. // *** IRunnableTask ***
  11. virtual STDMETHODIMP Run(void);
  12. virtual STDMETHODIMP Kill(BOOL bWait);
  13. virtual STDMETHODIMP Suspend(void);
  14. virtual STDMETHODIMP Resume(void);
  15. virtual STDMETHODIMP_(ULONG) IsRunning(void);
  16. // *** pure virtuals ***
  17. virtual STDMETHODIMP RunInitRT(void) PURE;
  18. virtual STDMETHODIMP KillRT(BOOL bWait) { return S_OK; };
  19. virtual STDMETHODIMP SuspendRT(void) { return S_OK; };
  20. virtual STDMETHODIMP ResumeRT(void) { return InternalResumeRT(); };
  21. virtual STDMETHODIMP InternalResumeRT(void) { _lState = IRTIR_TASK_FINISHED; return S_OK; };
  22. protected:
  23. CRunnableTask(DWORD dwFlags);
  24. virtual ~CRunnableTask();
  25. LONG _cRef;
  26. LONG _lState;
  27. DWORD _dwFlags; // RTF_*
  28. HANDLE _hDone;
  29. #ifdef DEBUG
  30. DWORD _dwTaskID;
  31. #endif
  32. };
  33. // CRunnableTask flags
  34. #define RTF_DEFAULT 0x00000000
  35. #define RTF_SUPPORTKILLSUSPEND 0x00000001
  36. #endif // _RUNTASK_H_