Leaked source code of windows server 2003
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
690 B

#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;
}