本文整理汇总了C++中ITask::FTrace方法的典型用法代码示例。如果您正苦于以下问题:C++ ITask::FTrace方法的具体用法?C++ ITask::FTrace怎么用?C++ ITask::FTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask::FTrace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//---------------------------------------------------------------------------
// @function:
// CUnittest::FSimulated
//
// @doc:
// Check if exception was injected by simulation
//
//---------------------------------------------------------------------------
BOOL
CUnittest::FSimulated
(
CException ex
)
{
ITask *ptsk = ITask::PtskSelf();
GPOS_ASSERT(NULL != ptsk);
return
(ptsk->FTrace(EtraceSimulateOOM) &&
GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiOOM)) ||
(ptsk->FTrace(EtraceSimulateAbort) &&
GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiAbort)) ||
(ptsk->FTrace(EtraceSimulateIOError) &&
GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiIOError)) ||
(ptsk->FTrace(EtraceSimulateNetError) &&
GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiNetError));
}
示例2:
//---------------------------------------------------------------------------
// @function:
// FSimulateIOErrorInternal
//
// @doc:
// Inject I/O exception
//
//---------------------------------------------------------------------------
static BOOL
FSimulateIOErrorInternal
(
INT iErrno,
const CHAR *szFile,
ULONG ulLine
)
{
BOOL fRes = false;
ITask *ptsk = ITask::PtskSelf();
if (NULL != ptsk &&
ptsk->FTrace(EtraceSimulateIOError) &&
CFSimulator::Pfsim()->FNewStack(CException::ExmaSystem, CException::ExmiIOError) &&
!GPOS_MATCH_EX(ptsk->Perrctxt()->Exc(), CException::ExmaSystem, CException::ExmiIOError))
{
// disable simulation temporarily to log injection
CAutoTraceFlag(EtraceSimulateIOError, false);
CLogger *plogger = dynamic_cast<CLogger*>(ITask::PtskSelf()->Ptskctxt()->PlogErr());
if (!plogger->FLogging())
{
GPOS_TRACE_FORMAT_ERR("Simulating I/O error at %s:%d", szFile, ulLine);
}
errno = iErrno;
if (ptsk->Perrctxt()->FPending())
{
ptsk->Perrctxt()->Reset();
}
// inject I/O error
fRes = true;
}
return fRes;
}
示例3:
//---------------------------------------------------------------------------
// @function:
// netutils::FSimulateNetError
//
// @doc:
// Inject networking exception
//
//---------------------------------------------------------------------------
BOOL
gpos::netutils::FSimulateNetError
(
INT iErrno,
const CHAR *szFile,
ULONG ulLine
)
{
GPOS_ASSERT(0 < iErrno);
ITask *ptsk = ITask::PtskSelf();
if (NULL != ptsk &&
ptsk->FTrace(EtraceSimulateNetError) &&
CFSimulator::Pfsim()->FNewStack(CException::ExmaSystem, CException::ExmiNetError) &&
!GPOS_MATCH_EX(ptsk->Perrctxt()->Exc(), CException::ExmaSystem, CException::ExmiNetError))
{
// disable simulation temporarily to log injection
CAutoTraceFlag(EtraceSimulateNetError, false);
CLogger *plogger = dynamic_cast<CLogger*>(ITask::PtskSelf()->Ptskctxt()->PlogErr());
if (!plogger->FLogging())
{
GPOS_TRACE_FORMAT_ERR("Simulating networking error at %s:%d", szFile, ulLine);
}
errno = iErrno;
if (ptsk->Perrctxt()->FPending())
{
ptsk->Perrctxt()->Reset();
}
return true;
}
return false;
}