IIsapiExtension::GetThreadWorker
Visual Studio .NET 2003
Call this method to get a pointer to the worker thread object for the current thread.
CIsapiWorker* GetThreadWorker( );
Return Value
Returns a pointer to the worker thread object for the current thread.
Remarks
The worker thread class returned by this method was previously set by a call to IIsapiExtension::SetThreadWorker.
Example
[ tag_name(name="WriteUserData") ]
HTTP_CODE OnWriteUserData(void)
{
// This method demonstrates how to allocate and free memory using
// the worker thread's heap.
CIsapiWorker* pWorker = m_spExtension->GetThreadWorker();
DWORD dwLen = m_spServerContext->GetTotalBytes();
char* szData = reinterpret_cast<char*>(
HeapAlloc(pWorker->m_hHeap, 0, dwLen));
if (!szData)
{
return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM);
}
if (!ReadClientData(m_spServerContext, szData, &dwLen, 0))
{
return HTTP_FAIL;
}
if (!m_HttpResponse.WriteLen(szData, dwLen))
{
return AtlsHttpError(500, ISE_SUBERR_OUTOFMEM);
}
// Free the allocated data.
if (szData)
{
BOOL bRet = HeapFree(pWorker->m_hHeap, 0, szData);
if (!bRet)
{
return HTTP_FAIL;
}
}
return HTTP_SUCCESS;
}
See Also
IIsapiExtension Overview | Class Members | IIsapiExtension::SetThreadWorker