【发布时间】:2009-10-06 05:22:19
【问题描述】:
为了进行调查,我需要知道硬编码值的存储位置。
问题:一个函数里面有硬编码的值,并且这个函数被多个线程同时调用,这个硬编码的值是否有可能被破坏。 p>
例如:myFunc 被多个线程同时调用。 “未处理的异常:”会损坏
void myFunc()
{
EXCEPTION_RECORD ExceptRec
bool retValue=doSomething(ExceptRec);
if(!retValue)
{
log ("Unhandled exception:"<< " code = " << hex << ExceptRec.ExceptionCode
<< " flags = " << ExceptRec.ExceptionFlags
<< " address = " << ExceptRec.ExceptionAddress)
// log is macro which will insert content into ostrstream
}
}
函数doSomething看起来像:
bool doSomething(EXCEPTION_RECORD &ExceptRec)
{
__try
{
// some code here
}
__except (ExceptRec = *(GetExceptionInformation())->ExceptionRecord,
EXCEPTION_EXECUTE_HANDLER)
{
return false;
}
return true;
}
【问题讨论】:
标签: c++ memory-management function