windows-nt/Source/XPSP1/NT/shell/services/hdsrv/lib/mischlpr.cpp

41 lines
650 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include "mischlpr.h"
HRESULT CThreadTask::RunWithTimeout(DWORD /*dwTimeout*/)
{
return E_NOTIMPL;
}
HRESULT CThreadTask::Run()
{
BOOL fResult;
HRESULT hr = S_OK;
fResult = QueueUserWorkItem(_ThreadProc, this, WT_EXECUTELONGFUNCTION);
if (!fResult)
{
DWORD dwErr = GetLastError();
hr = HRESULT_FROM_WIN32(dwErr);
}
return hr;
}
HRESULT CThreadTask::RunSynchronously()
{
return _DoStuff();
}
//static
DWORD WINAPI CThreadTask::_ThreadProc(void* pv)
{
DWORD dwRet;
CThreadTask* pTask = (CThreadTask*)pv;
dwRet = (DWORD)(pTask->_DoStuff());
delete pTask;
return dwRet;
}