UI Guy
2007-03-13 07:30:30 UTC
In an MFC pgm under VS2005sp1, I am creating a worker thread using
AfxBeginThread. Under certain circumstances which I can't quite pin
down, AfxBeginThread returns NULL, indicating it has failed. Is there
any way I can find out the cause of the failure, such as an error
code? I have tried tracing through the code with the debugger, but
what is apparently detecting the error condition is in MS code for
which I don't have the source.
My specific code is
CWinThread* pThread=AfxBeginThread(MyControlFunction,&ti,0/*priority*/,
230000000/*stack size*/);
and a test for pThread==NULL immediately following. It is a rather
large stack size.
The thread terminates by returning from MyControlFunction.
Usually creation of the worker thread succeeds the first time, and
fails the second. There seems to be some interaction between failure
and use of the file open common dialog in some preceding code.
AfxBeginThread. Under certain circumstances which I can't quite pin
down, AfxBeginThread returns NULL, indicating it has failed. Is there
any way I can find out the cause of the failure, such as an error
code? I have tried tracing through the code with the debugger, but
what is apparently detecting the error condition is in MS code for
which I don't have the source.
My specific code is
CWinThread* pThread=AfxBeginThread(MyControlFunction,&ti,0/*priority*/,
230000000/*stack size*/);
and a test for pThread==NULL immediately following. It is a rather
large stack size.
The thread terminates by returning from MyControlFunction.
Usually creation of the worker thread succeeds the first time, and
fails the second. There seems to be some interaction between failure
and use of the file open common dialog in some preceding code.