本文整理汇总了C++中Interrupt函数的典型用法代码示例。如果您正苦于以下问题:C++ Interrupt函数的具体用法?C++ Interrupt怎么用?C++ Interrupt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Interrupt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CL_DEBUG
void LLDBConnector::Detach()
{
if(IsCanInteract()) {
CL_DEBUG("Sending 'Detach' command");
LLDBCommand command;
command.SetCommandType(kCommandDetach);
SendCommand(command);
} else {
Interrupt(kInterruptReasonDetaching);
}
}
示例2: Interrupt
void BehaviorSet::ClearState(NPC *npc)
{
// Ensure any existing script is ended correctly.
Interrupt(npc);
for (size_t i = 0; i<behaviors.GetSize(); i++)
{
behaviors[i]->ResetNeed();
behaviors[i]->SetIsActive(false);
behaviors[i]->ClearInterrupted();
}
active = NULL;
}
示例3: HasFlag
void ActionInfo::Reset(UnitStateMgr* mgr)
{
if (!HasFlag(ACTION_STATE_INITIALIZED))
return;
if (!HasFlag(ACTION_STATE_INTERRUPTED) &&
HasFlag(ACTION_STATE_ACTIVE))
Interrupt(mgr);
RemoveFlag(ACTION_STATE_INITIALIZED);
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "ActionInfo: %s reset action %s", mgr->GetOwnerStr().c_str(), TypeName());
}
示例4: Interrupt
void CBSPLightingThread::StartLighting( char const *pVMFFileWithEntities )
{
// First, kill any lighting going on.
Interrupt();
// Store the VMF file data for the thread.
int len = strlen( pVMFFileWithEntities ) + 1;
m_VMFFileWithEntities.CopyArray( pVMFFileWithEntities, len );
// Tell the thread to start lighting.
SetThreadState( STATE_LIGHTING );
SetThreadCmd( THREADCMD_LIGHT );
}
示例5: Interrupt
bool Connection::Open(const char *filename, int open_flags) {
Interrupt();
Close();
if (nullptr == filename) {
return false;
}
int rc = sqlite3_open_v2(filename, &db_, open_flags, nullptr);
if (SQLITE_OK != rc) {
Close();
}
return SQLITE_OK == rc;
}
示例6: TRACE
// Primary entrypoint from the set of "debugger hooks", which the VM calls in
// response to various events. While this function is quite general wrt. the
// type of interrupt, practically the type will be one of the following:
// - ExceptionThrown
// - ExceptionHandler
// - BreakPointReached
// - HardBreakPoint
//
// Note: it is indeed a bit odd that interrupts due to single stepping come in
// as "BreakPointReached". Currently this results in spurious work in the
// debugger.
void Debugger::InterruptVMHook(int type /* = BreakPointReached */,
CVarRef e /* = null_variant */) {
TRACE(2, "Debugger::InterruptVMHook\n");
// Computing the interrupt site here pulls in more data from the Unit to
// describe the current execution point.
InterruptSite site(type == HardBreakPoint, e);
if (!site.valid()) {
// An invalid site is missing something like an ActRec, a func, or a
// Unit. Currently the debugger has no action to take at such sites.
return;
}
Interrupt(type, nullptr, &site);
}
示例7: Interrupt
bool RandomCircleMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{
if (creature.hasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_ON_VEHICLE))
{
i_nextMoveTime.Update(i_nextMoveTime.GetExpiry()); // Expire the timer
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
return true;
}
i_nextMoveTime.Update(diff);
if (!creature.IsStopped() && !creature.canFly())
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
if (creature.IsStopped())
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
if (!IsActive(creature)) // force stop processing (movement can move out active zone with cleanup movegens list)
{
Interrupt(creature);
return true;
}
if (m_splineMap.empty())
{
Reset(creature);
return true;
}
if (i_nextMoveTime.Passed())
{
if (m_splineMap.find(i_wpId) == m_splineMap.end())
{
Reset(creature);
return true;
}
SplineWayPointMap::iterator wp = m_splineMap.find(i_wpId);
//rellocate but not send
creature.Relocate(wp->second->x, wp->second->y, wp->second->z, wp->second->o);
if (i_wpId == 29) // not last wp
{
Initialize(creature);
return true;
}
i_wpId++;
i_nextMoveTime.Reset(500);
}
return true;
}
示例8: WaitForShutdown
void WaitForShutdown(boost::thread_group* threadGroup)
{
bool fShutdown = ShutdownRequested();
// Tell the main threads to shutdown.
while (!fShutdown)
{
MilliSleep(200);
fShutdown = ShutdownRequested();
}
if (threadGroup)
{
Interrupt(*threadGroup);
threadGroup->join_all();
}
}
示例9: Interrupt
void ProcessInterruptTerminateHandler::InterruptProcess(PROCESS_INFORMATION& info) {
//block from second call
if (IsInterrupted()) return;
LOG.LogInfo(L"Service process will be killed, exit code would be 42");
//TODO:implement kill process
if (0 == TerminateProcess(info.hProcess, 42)) {
LOG.LogWarnFormat(L"Failed to terminate service process. %s", LOG.GetLastError());
return;
}
//mark interrupt to the process was sent
Interrupt();
}
示例10: TryInt
// Try to take the latched interrupt
static inline void TryInt()
{
int nDid;
if (Doze.nInterruptLatch & DOZE_IRQSTATUS_NONE) {
return;
}
nDid = Interrupt(Doze.nInterruptLatch & 0xFF); // Success! we did some cycles, and took the interrupt
if (nDid > 0 && (Doze.nInterruptLatch & DOZE_IRQSTATUS_AUTO)) {
Doze.nInterruptLatch = DOZE_IRQSTATUS_NONE;
}
Doze.nCyclesLeft -= nDid;
}
示例11: CL_DEBUGS
void LLDBConnector::DeleteBreakpoints()
{
if ( IsCanInteract() ) {
CL_DEBUGS(wxString () << "codelite: deleting breakpoints (total of " << m_pendingDeletionBreakpoints.size() << " breakpoints)");
LLDBCommand command;
command.SetCommandType( kCommandDeleteBreakpoint );
command.SetBreakpoints( m_pendingDeletionBreakpoints );
SendCommand( command );
CL_DEBUGS(wxString () << "codelite: DeleteBreakpoints celar pending deletionbreakpoints queue");
m_pendingDeletionBreakpoints.clear();
} else {
CL_DEBUG("codelite: interrupting codelite-lldb for kInterruptReasonDeleteBreakpoint");
Interrupt( kInterruptReasonDeleteBreakpoint );
}
}
示例12: Interrupt
void ChaseMovementGenerator<T>::Finalize(T &owner)
{
Interrupt(owner);
if (Creature* creature = owner.ToCreature())
{
if (creature->IsAIEnabled)
creature->AI()->MovementInform(CHASE_MOTION_TYPE, 0);
if (creature->isPet())
return;
if (!creature->isInCombat())
creature->GetMotionMaster()->MoveTargetedHome();
}
}
示例13: SendCommand
void LLDBConnector::ApplyBreakpoints()
{
if(!m_breakpoints.empty()) {
if(IsCanInteract()) {
LLDBCommand command;
command.SetCommandType(kCommandApplyBreakpoints);
command.SetBreakpoints(GetUnappliedBreakpoints());
SendCommand(command);
m_breakpoints.clear();
} else {
Interrupt(kInterruptReasonApplyBreakpoints);
}
}
}
示例14: WrongArgument
void DataContainerImpl::getRecycleAccess(Recycler*const recycler)
{
if(! recycler)
throw WrongArgument();
unique_lock_t lock(m_mutex);
try
{
while(m_recycleAccess)
m_cond.wait(lock);
}
catch(boost::thread_interrupted&)
{
throw Interrupt();
}
m_recycleAccess = recycler;
}
示例15: SearchPV
/* 主要变例完全搜索例程,和零窗口完全搜索的区别有以下几点:
*
* 1. 启用内部迭代加深启发;
* 2. 不使用有负面影响的裁剪;
* 3. Alpha-Beta边界判定复杂;
* 4. PV结点要获取主要变例;
* 5. 考虑PV结点处理最佳着法的情况。
*/
static int SearchPV(int vlAlpha, int vlBeta, int nDepth, uint16_t *lpwmvPvLine) {
int nNewDepth, nHashFlag, vlBest, vl;
int mvBest, mvHash, mv, mvEvade;
MoveSortStruct MoveSort;
uint16_t wmvPvLine[LIMIT_DEPTH];
// 完全搜索例程包括以下几个步骤:
// 1. 在叶子结点处调用静态搜索;
*lpwmvPvLine = 0;
if (nDepth <= 0) {
__ASSERT(nDepth >= -NULL_DEPTH);
return SearchQuiesc(Search.pos, vlAlpha, vlBeta);
}
Search2.nAllNodes ++;
// 2. 无害裁剪;
vl = HarmlessPruning(Search.pos, vlBeta);
if (vl > -MATE_VALUE) {
return vl;
}
// 3. 置换裁剪;
vl = ProbeHash(Search.pos, vlAlpha, vlBeta, nDepth, NO_NULL, mvHash);
if (Search.bUseHash && vl > -MATE_VALUE) {
// 由于PV结点不适用置换裁剪,所以不会发生PV路线中断的情况
return vl;
}
// 4. 达到极限深度,直接返回评价值;
__ASSERT(Search.pos.nDistance > 0);
if (Search.pos.nDistance == LIMIT_DEPTH) {
return Evaluate(Search.pos, vlAlpha, vlBeta);
}
__ASSERT(Search.pos.nDistance < LIMIT_DEPTH);
// 5. 中断调用;
Search2.nMainNodes ++;
vlBest = -MATE_VALUE;
if ((Search2.nMainNodes & Search.nCountMask) == 0 && Interrupt()) {
return vlBest;
}
// 6. 内部迭代加深启发;
if (nDepth > IID_DEPTH && mvHash == 0) {
__ASSERT(nDepth / 2 <= nDepth - IID_DEPTH);
vl = SearchPV(vlAlpha, vlBeta, nDepth / 2, wmvPvLine);
if (vl <= vlAlpha) {
vl = SearchPV(-MATE_VALUE, vlBeta, nDepth / 2, wmvPvLine);
}
if (Search2.bStop) {
return vlBest;
}
mvHash = wmvPvLine[0];
}
// 7. 初始化;
mvBest = 0;
nHashFlag = HASH_ALPHA;
if (Search.pos.LastMove().ChkChs > 0) {
// 如果是将军局面,那么生成所有应将着法;
mvEvade = MoveSort.InitEvade(Search.pos, mvHash, Search2.wmvKiller[Search.pos.nDistance]);
} else {
// 如果不是将军局面,那么使用正常的着法列表。
MoveSort.InitFull(Search.pos, mvHash, Search2.wmvKiller[Search.pos.nDistance]);
mvEvade = 0;
}
// 8. 按照"MoveSortStruct::NextFull()"例程的着法顺序逐一搜索;
while ((mv = MoveSort.NextFull(Search.pos)) != 0) {
if (Search.pos.MakeMove(mv)) {
// 9. 尝试选择性延伸;
nNewDepth = (Search.pos.LastMove().ChkChs > 0 || mvEvade != 0 ? nDepth : nDepth - 1);
// 10. 主要变例搜索;
if (vlBest == -MATE_VALUE) {
vl = -SearchPV(-vlBeta, -vlAlpha, nNewDepth, wmvPvLine);
} else {
vl = -SearchCut(-vlAlpha, nNewDepth);
if (vl > vlAlpha && vl < vlBeta) {
vl = -SearchPV(-vlBeta, -vlAlpha, nNewDepth, wmvPvLine);
}
}
Search.pos.UndoMakeMove();
if (Search2.bStop) {
return vlBest;
}
// 11. Alpha-Beta边界判定;
if (vl > vlBest) {
vlBest = vl;
if (vl >= vlBeta) {
//.........这里部分代码省略.........