
This is really a strange behavior. I can your sample app in VC 2003 without any crashes... Try to comment the output to std::cout after your timer has elapsed... Maybe there is a problem with writing to streams and cout somehow does not block and main exists while cout is written... ? On Thu, April 27, 2006 2:42, Rush Manbert said:
Brown Gabe wrote:
Hi Everyone,
Hopefully this isn't some noob question, but here goes... I'm trying to run boost 1.3.1 in Visual C++ 8 VC8 and I keep getting an access violation at the termination of my thread. I've tried looking to see what the problem is but I can't seem to determine the problem. I'm using the plain example thread.cpp
<snip>
I get the expected out from the application. Upon tracing my code, the exception only occurs when the worker thread exits.
Exception occured in threadex.c on line 348. Unhandled exception at 0x7c9012b4 in test.exe: 0xC0000005: Access violation reading location 0xcccccccc.
" __try { _endthreadex ( ( (unsigned (__CLR_OR_STD_CALL *)(void *))(((_ptiddata)ptd)->_initaddr) ) ( ((_ptiddata)ptd)->_initarg ) ) ;"
Any thoughts on what might cause an error like this???
--
Others may have more intelligent, or more focused, suggestions, but here are two things to check:
1) 0xcccccccc looks very much like the contents of an uninitialized variable when running under the debug heap management code. My guess is that you are using an uninitialized pointer value whose contents are 0xcccccccc.
See http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c9535__1 the follow the "continued" link to the second page. The fill values are listed there.
2) I assume you're using VS 2005? The Debug | Exceptions... dialog lets you set it to break when an exception is thrown, rather than fielding an unhandled exception. I don't know anything about debugging threads, though.
Best of luck, Rush