• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Interrupt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Interrupt函数的典型用法代码示例。如果您正苦于以下问题:C++ Interrupt函数的具体用法?C++ Interrupt怎么用?C++ Interrupt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Interrupt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CL_DEBUG

void LLDBConnector::Detach()
{
    if(IsCanInteract()) {
        CL_DEBUG("Sending 'Detach' command");
        LLDBCommand command;
        command.SetCommandType(kCommandDetach);
        SendCommand(command);

    } else {
        Interrupt(kInterruptReasonDetaching);
    }
}
开发者ID:stahta01,项目名称:codelite,代码行数:12,代码来源:LLDBConnector.cpp


示例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;
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:12,代码来源:npcbehave.cpp


示例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());
}
开发者ID:alolo,项目名称:mangos,代码行数:12,代码来源:StateMgr.cpp


示例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 );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:13,代码来源:bsplightingthread.cpp


示例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;
	}
开发者ID:tangjie,项目名称:app,代码行数:13,代码来源:connection.cpp


示例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);
}
开发者ID:floreal,项目名称:hiphop-php,代码行数:24,代码来源:debugger.cpp


示例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;
}
开发者ID:Archives,项目名称:try,代码行数:49,代码来源:RandomMovementGenerator.cpp


示例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();
    }
}
开发者ID:SolidXPartners,项目名称:bitcoin,代码行数:15,代码来源:bitcoind.cpp


示例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();
}
开发者ID:jonnyzzz,项目名称:JetService,代码行数:15,代码来源:ProcessInterruptTerminateHandler.cpp


示例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;
}
开发者ID:0nem4n,项目名称:ggpofba,代码行数:16,代码来源:doze.cpp


示例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 );
    }
}
开发者ID:blitz-research,项目名称:codelite,代码行数:16,代码来源:LLDBConnector.cpp


示例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();
    }
}
开发者ID:Xadras,项目名称:looking4group-core,代码行数:16,代码来源:TargetedMovementGenerator.cpp


示例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);
        }
    }
}
开发者ID:stahta01,项目名称:codelite,代码行数:16,代码来源:LLDBConnector.cpp


示例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;
 }
开发者ID:joccccc,项目名称:stromx,代码行数:19,代码来源:DataContainerImpl.cpp


示例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) {
//.........这里部分代码省略.........
开发者ID:QiuleiWang,项目名称:eleeye,代码行数:101,代码来源:search.cpp


示例16: SearchCut

// 零窗口完全搜索例程
static int SearchCut(int vlBeta, int nDepth, bool bNoNull = false) {
  int nNewDepth, vlBest, vl;
  int mvHash, mv, mvEvade;
  MoveSortStruct MoveSort;
  // 完全搜索例程包括以下几个步骤:

  // 1. 在叶子结点处调用静态搜索;
  if (nDepth <= 0) {
    __ASSERT(nDepth >= -NULL_DEPTH);
    return SearchQuiesc(Search.pos, vlBeta - 1, vlBeta);
  }
  Search2.nAllNodes ++;

  // 2. 无害裁剪;
  vl = HarmlessPruning(Search.pos, vlBeta);
  if (vl > -MATE_VALUE) {
    return vl;
  }

  // 3. 置换裁剪;
  vl = ProbeHash(Search.pos, vlBeta - 1, vlBeta, nDepth, bNoNull, mvHash);
  if (Search.bUseHash && vl > -MATE_VALUE) {
    return vl;
  }

  // 4. 达到极限深度,直接返回评价值;
  if (Search.pos.nDistance == LIMIT_DEPTH) {
    return Evaluate(Search.pos, vlBeta - 1, vlBeta);
  }
  __ASSERT(Search.pos.nDistance < LIMIT_DEPTH);

  // 5. 中断调用;
  Search2.nMainNodes ++;
  vlBest = -MATE_VALUE;
  if ((Search2.nMainNodes & Search.nCountMask) == 0 && Interrupt()) {
    return vlBest;
  }

  // 6. 尝试空着裁剪;
  if (Search.bNullMove && !bNoNull && Search.pos.LastMove().ChkChs <= 0 && Search.pos.NullOkay()) {
    Search.pos.NullMove();
    vl = -SearchCut(1 - vlBeta, nDepth - NULL_DEPTH - 1, NO_NULL);
    Search.pos.UndoNullMove();
    if (Search2.bStop) {
      return vlBest;
    }

    if (vl >= vlBeta) {
      if (Search.pos.NullSafe()) {
        // a. 如果空着裁剪不带检验,那么记录深度至少为(NULL_DEPTH + 1);
        RecordHash(Search.pos, HASH_BETA, vl, MAX(nDepth, NULL_DEPTH + 1), 0);
        return vl;
      } else if (SearchCut(vlBeta, nDepth - NULL_DEPTH, NO_NULL) >= vlBeta) {
        // b. 如果空着裁剪带检验,那么记录深度至少为(NULL_DEPTH);
        RecordHash(Search.pos, HASH_BETA, vl, MAX(nDepth, NULL_DEPTH), 0);
        return vl;
      }
    }
  }

  // 7. 初始化;
  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. 零窗口搜索;
      vl = -SearchCut(1 - vlBeta, nNewDepth);
      Search.pos.UndoMakeMove();
      if (Search2.bStop) {
        return vlBest;
      }

      // 11. 截断判定;
      if (vl > vlBest) {
        vlBest = vl;
        if (vl >= vlBeta) {
          RecordHash(Search.pos, HASH_BETA, vlBest, nDepth, mv);
          if (!MoveSort.GoodCap(Search.pos, mv)) {
            SetBestMove(mv, nDepth, Search2.wmvKiller[Search.pos.nDistance]);
          }
          return vlBest;
        }
      }
    }
  }

  // 12. 不截断措施。
//.........这里部分代码省略.........
开发者ID:QiuleiWang,项目名称:eleeye,代码行数:101,代码来源:search.cpp


示例17: TRACE

void Debugger::InterruptSessionStarted(const char *file,
                                       const char *error /* = NULL */) {
  TRACE(2, "Debugger::InterruptSessionStarted\n");
  get().registerThread(); // Register this thread as being debugged
  Interrupt(SessionStarted, file, nullptr, error);
}
开发者ID:fredemmott,项目名称:hhvm,代码行数:6,代码来源:debugger.cpp


示例18: Interrupt

/* Generate interrupts */
static void Interrupt(void)
{
	/* the 6805 latches interrupt requests internally, so we don't clear */
	/* pending_interrupts until the interrupt is taken, no matter what the */
	/* external IRQ pin does. */

#if (1) //HAS_HD63705)
	if( (m6805.pending_interrupts & (1<<HD63705_INT_NMI)) != 0)
	{
		PUSHWORD(m6805.pc);
		PUSHBYTE(m6805.x);
		PUSHBYTE(m6805.a);
		PUSHBYTE(m6805.cc);
        SEI;
		/* no vectors supported, just do the callback to clear irq_state if needed */
		if (m6805.irq_callback)
			(*m6805.irq_callback)(0);

		RM16( 0x1ffc, &pPC);
		change_pc(PC);
		m6805.pending_interrupts &= ~(1<<HD63705_INT_NMI);

		m6805_ICount -= 11;

	}
	else if( (m6805.pending_interrupts & ((1<<M6805_IRQ_LINE)|HD63705_INT_MASK)) != 0 ) {
		if ( (CC & IFLAG) == 0 ) {
#else
	if( (m6805.pending_interrupts & (1<<M6805_IRQ_LINE)) != 0 ) {
		if ( (CC & IFLAG) == 0 ) {
#endif
	{
        /* standard IRQ */
//#if (HAS_HD63705)
//      if(SUBTYPE!=SUBTYPE_HD63705)
//#endif
//          PC |= ~AMASK;
		PUSHWORD(m6805.pc);
		PUSHBYTE(m6805.x);
		PUSHBYTE(m6805.a);
		PUSHBYTE(m6805.cc);
        SEI;
		/* no vectors supported, just do the callback to clear irq_state if needed */
		if (m6805.irq_callback)
			(*m6805.irq_callback)(0);


//#if (HAS_HD63705)
		if(SUBTYPE==SUBTYPE_HD63705)
		{
			/* Need to add emulation of other interrupt sources here KW-2/4/99 */
			/* This is just a quick patch for Namco System 2 operation         */

			if((m6805.pending_interrupts&(1<<HD63705_INT_IRQ1))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_IRQ1);
				RM16( 0x1ff8, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_IRQ2))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_IRQ2);
				RM16( 0x1fec, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_ADCONV))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_ADCONV);
				RM16( 0x1fea, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER1))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER1);
				RM16( 0x1ff6, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER2))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER2);
				RM16( 0x1ff4, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_TIMER3))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_TIMER3);
				RM16( 0x1ff2, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_PCI))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_PCI);
				RM16( 0x1ff0, &pPC);
				change_pc(PC);
			}
			else if((m6805.pending_interrupts&(1<<HD63705_INT_SCI))!=0)
			{
				m6805.pending_interrupts &= ~(1<<HD63705_INT_SCI);
				RM16( 0x1fee, &pPC);
//.........这里部分代码省略.........
开发者ID:tigerking,项目名称:FB-Alpha,代码行数:101,代码来源:m6805.cpp


示例19: Interrupt

	void Keyboard::install()
	{
		IDT::interrupt(0x21) = Interrupt(Keyboard::dispatchIRQ);
	}
开发者ID:MasterQ32,项目名称:DasOS,代码行数:4,代码来源:keyboard.cpp


示例20: AppInit


//.........这里部分代码省略.........
            strUsage += "\n" + gArgs.GetHelpMessage();
        }

        fprintf(stdout, "%s", strUsage.c_str());
        return true;
    }

    try
    {
        if (!fs::is_directory(GetDataDir(false)))
        {
            fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
            return false;
        }
        if (!gArgs.ReadConfigFiles(error, true)) {
            fprintf(stderr, "Error reading configuration file: %s\n", error.c_str());
            return false;
        }
        // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
        try {
            SelectParams(gArgs.GetChainName());
        } catch (const std::exception& e) {
            fprintf(stderr, "Error: %s\n", e.what());
            return false;
        }

        // Error out when loose non-argument tokens are encountered on command line
        for (int i = 1; i < argc; i++) {
            if (!IsSwitchChar(argv[i][0])) {
                fprintf(stderr, "Error: Command line contains unexpected token '%s', see digibyted -h for a list of options.\n", argv[i]);
                return false;
            }
        }

        // -server defaults to true for digibyted but not for the GUI so do this here
        gArgs.SoftSetBoolArg("-server", true);
        // Set this early so that parameter interactions go to console
        InitLogging();
        InitParameterInteraction();
        if (!AppInitBasicSetup())
        {
            // InitError will have been called with detailed error, which ends up on console
            return false;
        }
        if (!AppInitParameterInteraction())
        {
            // InitError will have been called with detailed error, which ends up on console
            return false;
        }
        if (!AppInitSanityChecks())
        {
            // InitError will have been called with detailed error, which ends up on console
            return false;
        }
        if (gArgs.GetBoolArg("-daemon", false))
        {
#if HAVE_DECL_DAEMON
#if defined(MAC_OSX)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
            fprintf(stdout, "DigiByte server starting\n");

            // Daemonize
            if (daemon(1, 0)) { // don't chdir (1), do close FDs (0)
                fprintf(stderr, "Error: daemon() failed: %s\n", strerror(errno));
                return false;
            }
#if defined(MAC_OSX)
#pragma GCC diagnostic pop
#endif
#else
            fprintf(stderr, "Error: -daemon is not supported on this operating system\n");
            return false;
#endif // HAVE_DECL_DAEMON
        }
        // Lock data directory after daemonization
        if (!AppInitLockDataDirectory())
        {
            // If locking the data directory failed, exit immediately
            return false;
        }
        fRet = AppInitMain();
    }
    catch (const std::exception& e) {
        PrintExceptionContinue(&e, "AppInit()");
    } catch (...) {
        PrintExceptionContinue(nullptr, "AppInit()");
    }

    if (!fRet)
    {
        Interrupt();
    } else {
        WaitForShutdown();
    }
    Shutdown();

    return fRet;
}
开发者ID:DigiByte-Core,项目名称:digibyte,代码行数:101,代码来源:digibyted.cpp



注:本文中的Interrupt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InterruptTheCard函数代码示例发布时间:2022-05-30
下一篇:
C++ Interpolate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap