Re: Need help solving a threading issue
"shadowulf" <shadowulf@discussions.microsoft.com> wrote in message
news:9F6B40A9-C2E9-4CAB-82EE-25243E7983F5@microsoft.com...
Hi Scott & David,
Let me correct something - I believe i was wrong in calling my thread a
'worker' thread I was just trying to indicate it to be an alternative
thread
to my main thread, which i have manually created. I create the thread as
follows:
UINT ThreadedNW (LPVOID pParam);
void CSvrProcessManager::_InitNetworkServer()
{
/* some code here */
// create the thread
CWinThread* m_Thread = AfxBeginThread(ThreadedNW, this);
}
[snip]
This is a worker thread, due to the fact you're passing a callback function
in the first parameter. You need to use this one:
CWinThread* AfxBeginThread( CRuntimeClass* pThreadClass, int nPriority =
THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );
Read up on AfxBeginThread to create a CWinThread-derived class that you then
pass using the RUNTIME_CLASS macro.
-- David