|
Hi,
i need some help to solve this problem after create of worker thread.
When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}
but after maybe 10 seconds i receive this error message:
and the debugger show in this code in the file thrdcore.cpp:
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}
A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function?
No parameter is NULL, what i'm doing wrong?
Any help is welcome
Thanks
bosfan
|
|
|
|
|
Answer these two questions.
1) Provide the prototype of your function controlfunc>
2) What do you pass as params?
|
|
|
|
|
It's impossible to guess what may be wrong with the information you provided. You should use your debugger to set some breakpoints in your code, and check the actual values of the various parameters at the time of the failure. You can also use the stacktrace to see which functions have been called recently.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
thanks for reply i try to solve this in this way.
best regards
bosfan
|
|
|
|
|
Could be wrong here but I think you have to call a Macro just after the thread enters in order to set it up properly, google it, it is well known. (Had this years ago, and havent done any user mode for ages. )
|
|
|
|
|
Try enabling the "page heap" for your application. It can be a little painful but it often finds the cause of problems like yours.
Steve
|
|
|
|