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.

40 lines
650 B

  1. #include "mischlpr.h"
  2. HRESULT CThreadTask::RunWithTimeout(DWORD /*dwTimeout*/)
  3. {
  4. return E_NOTIMPL;
  5. }
  6. HRESULT CThreadTask::Run()
  7. {
  8. BOOL fResult;
  9. HRESULT hr = S_OK;
  10. fResult = QueueUserWorkItem(_ThreadProc, this, WT_EXECUTELONGFUNCTION);
  11. if (!fResult)
  12. {
  13. DWORD dwErr = GetLastError();
  14. hr = HRESULT_FROM_WIN32(dwErr);
  15. }
  16. return hr;
  17. }
  18. HRESULT CThreadTask::RunSynchronously()
  19. {
  20. return _DoStuff();
  21. }
  22. //static
  23. DWORD WINAPI CThreadTask::_ThreadProc(void* pv)
  24. {
  25. DWORD dwRet;
  26. CThreadTask* pTask = (CThreadTask*)pv;
  27. dwRet = (DWORD)(pTask->_DoStuff());
  28. delete pTask;
  29. return dwRet;
  30. }