当前位置: 首页>>代码示例>>C++>>正文


C++ Wait函数代码示例

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


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

示例1: while

void CDVDMsgGeneralSynchronize::Wait(std::atomic<bool>& abort, unsigned int source)
{
  while(!Wait(100, source) && !abort);
}
开发者ID:DaHenchmen,项目名称:DHMC,代码行数:4,代码来源:DVDMessage.cpp

示例2: checkReflectiveStrips

void Robot::RightLeftAuton() {
    float targetValue;
    const float targetDistance = 295.0;
    Timer* timer = new Timer;
    timer->Reset();
    robotDrive->resetEncoders();
    timer->Start();
    bool state = checkReflectiveStrips();

    robotDrive->drive(0, 0);
    Wait(0.5);
    robotDrive->drive(-0.1, 0);
    Wait(.25);
    claw->SetAngle(115.0);
    Wait(0.5);

    /* "&& robotDrive->getRightDist() > -5.0" ensures robot doesn't drive
     * backwards
     */
    while (robotDrive->getRightDist() < targetDistance && IsEnabled() &&
           robotDrive->getRightDist() > -5.0 && IsAutonomous()) {
        targetValue =
            -0.6 * (1.f - robotDrive->getRightDist() / targetDistance);
        robotDrive->drive(targetValue, 0);

        // std::cout << "right distance: " << (robotDrive->getRightDist())<<
        // std::endl;
        // std::cout << "left distance: " << (robotDrive->getLeftDist()) <<
        // std::endl;
        // std::cout << "targetValue: " << targetValue << std::endl;

        if (claw->onTarget()) {
            claw->SetWheelManual(0.0);
        }
        claw->Update();
        Wait(0.1);
    }

    robotDrive->drive(0, 0);
    // std::cout << "final right distance: " << (robotDrive->getRightDist()) <<
    // std::endl;
    // std::cout << "final left distance: " << (robotDrive->getLeftDist()) <<
    // std::endl;

    while (robotDrive->getLeftDist() * -1 < robotDrive->getRightDist() &&
           IsEnabled() && IsAutonomous()) {
        robotDrive->setLeftManual(0.3);
    }
    claw->SetWheelManual(0.0);
    robotDrive->drive(-0.1, 0);
    Wait(0.1);
    robotDrive->drive(0, 0);
    if (state == true) {
        claw->Shoot();
    } else {
        while (timer->HasPeriodPassed(5) == false) {
            Wait(0.01);
        }
        claw->Shoot();
    }
    while (IsEnabled() && IsAutonomous()) {
        claw->Update();
        Wait(0.1);
    }
}
开发者ID:Team3512,项目名称:Robot-2014,代码行数:65,代码来源:RightLeftAuton.cpp

示例3: Engage

void CMobController::DoRoamTick(time_point tick)
{
    // If there's someone on our enmity list, go from roaming -> engaging
    if (PMob->PEnmityContainer->GetHighestEnmity() != nullptr && !(PMob->m_roamFlags & ROAMFLAG_IGNORE))
    {
        Engage(PMob->PEnmityContainer->GetHighestEnmity()->targid);
        return;
    }
    else if (PMob->m_OwnerID.id != 0 && !(PMob->m_roamFlags & ROAMFLAG_IGNORE))
    {
        // i'm claimed by someone and need hate towards this person
        PTarget = (CBattleEntity*)PMob->GetEntity(PMob->m_OwnerID.targid, TYPE_PC | TYPE_MOB | TYPE_PET);

        PMob->PEnmityContainer->AddBaseEnmity(PTarget);

        Engage(PTarget->targid);
        return;
    }
    //#TODO
    else if (PMob->GetDespawnTime() > time_point::min() && PMob->GetDespawnTime() < m_Tick)
    {
        Despawn();
        return;
    }

    if (PMob->m_roamFlags & ROAMFLAG_IGNORE)
    {
        // don't claim me if I ignore
        PMob->m_OwnerID.clean();
    }

    //skip roaming if waiting
    if (m_Tick >= m_WaitTime)
    {
        // don't aggro a little bit after I just disengaged
        PMob->m_neutral = PMob->CanBeNeutral() && m_Tick <= m_NeutralTime + 10s;

        if (PMob->PAI->PathFind->IsFollowingPath())
        {
            FollowRoamPath();
        }
        else if (m_Tick >= m_LastActionTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL)))
        {
            // lets buff up or move around

            if (PMob->CalledForHelp())
            {
                PMob->CallForHelp(false);
            }

            // can't rest with poison or disease
            if (PMob->CanRest())
            {
                // recover 10% health
                if (PMob->Rest(0.1f))
                {
                    // health updated
                    PMob->updatemask |= UPDATE_HP;
                }

                if (PMob->GetHPP() == 100)
                {
                    // at max health undirty exp
                    PMob->m_giveExp = true;
                }
            }

            // if I just disengaged check if I should despawn
            if (PMob->IsFarFromHome())
            {
                if (PMob->CanRoamHome() && PMob->PAI->PathFind->PathTo(PMob->m_SpawnPoint))
                {
                    // walk back to spawn if too far away

                    // limit total path to just 10 or
                    // else we'll move straight back to spawn
                    PMob->PAI->PathFind->LimitDistance(10.0f);

                    FollowRoamPath();

                    // move back every 5 seconds
                    m_LastActionTime = m_Tick - (std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL)) + 10s);
                }
                else if (!PMob->getMobMod(MOBMOD_NO_DESPAWN) != 0 &&
                    !map_config.mob_no_despawn)
                {
                    PMob->PAI->Despawn();
                    return;
                }
            }
            else
            {
                // No longer including conditional for ROAMFLAG_AMBUSH now that using mixin to handle mob hiding
                if (PMob->getMobMod(MOBMOD_SPECIAL_SKILL) != 0 &&
                    m_Tick >= m_LastSpecialTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_SPECIAL_COOL)) &&
                    TrySpecialSkill())
                {
                    // I spawned a pet
                }
                else if (PMob->GetMJob() == JOB_SMN && CanCastSpells() && PMob->SpellContainer->HasBuffSpells() &&
//.........这里部分代码省略.........
开发者ID:Xaver-Entropia,项目名称:darkstar,代码行数:101,代码来源:mob_controller.cpp

示例4: while

int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        // Should selected items be added to the current selection or
        // become the new selection (discarding previously selected items)
        m_additive = evt->Modifier( MD_SHIFT );

        // Should selected items be REMOVED from the current selection?
        // This will be ignored if the SHIFT modifier is pressed
        m_subtractive = !m_additive && evt->Modifier( MD_CTRL );

        // Is the user requesting that the selection list include all possible
        // items without removing less likely selection candidates
        m_skip_heuristics = !!evt->Modifier( MD_ALT );

        // Single click? Select single object
        if( evt->IsClick( BUT_LEFT ) )
        {
            // If no modifier keys are pressed, clear the selection
            if( !m_additive )
                ClearSelection();

            SelectPoint( evt->Position());
        }

        // right click? if there is any object - show the context menu
        else if( evt->IsClick( BUT_RIGHT ) )
        {
            bool selectionCancelled = false;

            if( m_selection.Empty() )
            {
                SelectPoint( evt->Position(), &selectionCancelled );
                m_selection.SetIsHover( true );
            }

            if( !selectionCancelled )
                m_menu.ShowContextMenu( m_selection );
        }

        // double click? Display the properties window
        else if( evt->IsDblClick( BUT_LEFT ) )
        {
            // No double-click actions currently defined
        }

        // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
        else if( evt->IsDrag( BUT_LEFT ) )
        {
            if( m_additive || m_subtractive || m_selection.Empty() )
            {
                selectMultiple();
            }
            else
            {
                // Check if dragging has started within any of selected items bounding box
                if( selectionContains( evt->Position() ) )
                {
                    // Yes -> run the move tool and wait till it finishes
                    m_toolMgr->InvokeTool( "plEditor.InteractiveEdit" );
                }
                else
                {
                    // No -> clear the selection list
                    ClearSelection();
                }
            }
        }

        else if( evt->IsAction( &ACTIONS::cancelInteractive ) || evt->IsCancel() )
        {
            ClearSelection();
        }

        else if( evt->Action() == TA_UNDO_REDO_PRE )
        {
            ClearSelection();
        }

        else if( evt->Action() == TA_CONTEXT_MENU_CLOSED )
        {
            m_menu.CloseContextMenu( evt );
        }

        else
            m_toolMgr->PassEvent();
    }

    // This tool is supposed to be active forever
    assert( false );

    return 0;
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:95,代码来源:pl_selection_tool.cpp

示例5: SetContextMenu

bool PL_SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector )
{
    EDA_ITEM*   current = nullptr;
    ACTION_MENU menu;

    int limit = std::min( MAX_SELECT_ITEM_IDS, aCollector->GetCount() );

    for( int i = 0; i < limit; ++i )
    {
        wxString text;
        EDA_ITEM* item = ( *aCollector )[i];
        text = item->GetSelectMenuText( m_frame->GetUserUnits() );

        wxString menuText = wxString::Format("&%d. %s", i + 1, text );
        menu.Add( menuText, i + 1, item->GetMenuImage() );
    }

    if( aCollector->m_MenuTitle.Length() )
        menu.SetTitle( aCollector->m_MenuTitle );

    menu.SetIcon( info_xpm );
    menu.DisplayTitle( true );
    SetContextMenu( &menu, CMENU_NOW );

    while( OPT_TOOL_EVENT evt = Wait() )
    {
        if( evt->Action() == TA_CONTEXT_MENU_UPDATE )
        {
            if( current )
                unhighlight( current, BRIGHTENED );

            int id = *evt->GetCommandId();

            // User has pointed an item, so show it in a different way
            if( id > 0 && id <= limit )
            {
                current = ( *aCollector )[id - 1];
                highlight( current, BRIGHTENED );
            }
            else
            {
                current = NULL;
            }
        }
        else if( evt->Action() == TA_CONTEXT_MENU_CHOICE )
        {
            if( current )
                unhighlight( current, BRIGHTENED );

            OPT<int> id = evt->GetCommandId();

            // User has selected an item, so this one will be returned
            if( id && ( *id > 0 ) )
                current = ( *aCollector )[*id - 1];
            else
                current = NULL;

            break;
        }

        getView()->UpdateItems();
        m_frame->GetCanvas()->Refresh();
    }

    if( current )
    {
        unhighlight( current, BRIGHTENED );

        getView()->UpdateItems();
        m_frame->GetCanvas()->Refresh();

        aCollector->Empty();
        aCollector->Append( current );
        return true;
    }

    return false;
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:78,代码来源:pl_selection_tool.cpp

示例6: while

int ComprDataIO::UnpRead(unsigned char *Addr,unsigned int Count)
{
  int RetCode=0,TotalRead=0;
  unsigned char *ReadAddr;
  ReadAddr=Addr;
  while (Count > 0)
  {
    Archive *SrcArc=(Archive *)SrcFile;

    unsigned int ReadSize=(Count>UnpPackedSize) ? int64to32(UnpPackedSize):Count;
    if (UnpackFromMemory)
    {
      memcpy(Addr,UnpackFromMemoryAddr,UnpackFromMemorySize);
      RetCode=UnpackFromMemorySize;
      UnpackFromMemorySize=0;
    }
    else
    {
      if (!SrcFile->IsOpened())
        return(-1);
      RetCode=SrcFile->Read(ReadAddr,ReadSize);
      FileHeader *hd=SubHead!=NULL ? SubHead:&SrcArc->NewLhd;
      if (hd->Flags & LHD_SPLIT_AFTER)
        PackedCRC=CRC(PackedCRC,ReadAddr,ReadSize);
    }
    CurUnpRead+=RetCode;
    ReadAddr+=RetCode;
    TotalRead+=RetCode;
    Count-=RetCode;
    UnpPackedSize-=RetCode;
    if (UnpPackedSize == 0 && UnpVolume)
    {
#ifndef NOVOLUME
      if (!MergeArchive(*SrcArc,this,true,CurrentCommand))
#endif
      {
        NextVolumeMissing=true;
        return(-1);
      }
    }
    else
      break;
  }
  Archive *SrcArc=(Archive *)SrcFile;
  if (SrcArc!=NULL)
    ShowUnpRead(SrcArc->CurBlockPos+CurUnpRead,UnpArcSize);
  if (RetCode!=-1)
  {
    RetCode=TotalRead;
#ifndef NOCRYPT
    if (Decryption)
#ifndef SFX_MODULE
      if (Decryption<20)
        Decrypt.Crypt(Addr,RetCode,(Decryption==15) ? NEW_CRYPT : OLD_DECODE);
      else
        if (Decryption==20)
          for (unsigned int I=0;I<RetCode;I+=16)
            Decrypt.DecryptBlock20(&Addr[I]);
        else
#endif
        {
          int CryptSize=(RetCode & 0xf)==0 ? RetCode:((RetCode & ~0xf)+16);
          Decrypt.DecryptBlock(Addr,CryptSize);
        }
#endif
  }
  Wait();
  return(RetCode);
}
开发者ID:BITINT,项目名称:DEFCON2,代码行数:69,代码来源:rdwrfn.cpp

示例7: Wait

void cChunkSender::Stop(void)
{
	m_ShouldTerminate = true;
	m_evtQueue.Set();
	Wait();
}
开发者ID:JoeClacks,项目名称:MCServer,代码行数:6,代码来源:ChunkSender.cpp

示例8: main

//------------------------------------------------------------------------------
int main(void)
{
  VICConfig();
  TimingInit();
  LEDInit();
  UART1Init();
  UART2Init();
  I2CInit();
  SPISlaveInit();

  Wait(100);
  UART1Printf("University of Tokyo NaviCtrl firmware V2");

  ReadEEPROM();
  UBloxInit();
  LSM303DLInit();
  FlightCtrlCommsInit();
  SDCardInit();
  NavigationInit();

  ExternalButtonInit();

  // Enable the "new data" interrupt.
  VIC_Config(EXTIT0_ITLine, VIC_IRQ, IRQ_PRIORITY_NEW_DATA);
  VIC_ITCmd(EXTIT0_ITLine, ENABLE);

  // Enable the 50Hz Interrupt.
  VIC_Config(EXTIT3_ITLine, VIC_IRQ, IRQ_PRIORITY_50HZ);
  VIC_ITCmd(EXTIT3_ITLine, ENABLE);

  // Main loop.
  uint32_t led_timer = GetTimestamp();
  for (;;)
  {
#ifndef VISION
    // Check for new data from the magnetometer.
    ProcessIncomingLSM303DL();

    // Skip the rest of the main loop if mag calibration is ongoing.
    if (MagCalibration(mag_calibration_)) continue;

    // Check for new data on the GPS UART port.
    ProcessIncomingUBlox();
#endif

    // Check for new data from the FlightCtrl.
    if (NewDataFromFlightCtrl())
    {
      ClearNewDataFromFlightCtrlFlag();

#ifdef VISION
      KalmanAccelerometerUpdate();
#endif

      UpdateNavigation();

      PrepareFlightCtrlDataExchange();

#ifndef VISION
      RequestLSM303DL();
#endif

      // Check if new data has come while processing the data. This indicates
      // that processing did not complete fast enough.
      if (NewDataFromFlightCtrl())
      {
        overrun_counter_++;
      }
    }

#ifndef VISION
    CheckUBXFreshness();
    CheckLSM303DLFreshness();

    // Normally the magnetometer is read every time new data comes from the
    // FlightCtrl. The following statement is a backup that ensures the
    // magnetometer is updated even if there is no connection to the FlightCtrl
    // and also deals with read errors.
    if (LSM303DLDataStale())
    {
      if (MillisSinceTimestamp(LSM303DLLastRequestTimestamp()) > 20)
        RequestLSM303DL();
      if (LSM303DLErrorBits() & LSM303DL_ERROR_BIT_I2C_BUSY)
        I2CReset();
    }
#else
    CheckVisionFreshness();
#endif

    // Check for incoming data on the "update & debug" UART port.
    ProcessIncomingUART1();

    // Check for incoming data on the "FligthCtrl" UART port.
    ProcessIncomingUART2();

    ProcessLogging();

    if (TimestampInPast(led_timer))
    {
//.........这里部分代码省略.........
开发者ID:ctraabe,项目名称:NaviCtrl,代码行数:101,代码来源:main.c

示例9: OperatorControl

	void OperatorControl(void)
	{

		bool button1Bool;
		bool button2Bool;
		bool button3Bool;
		bool button4Bool;
		bool button5Bool;
		bool button6Bool;
		bool button7Bool;
		bool button8Bool;
		bool button9Bool;
		bool button10Bool;
		bool button11Bool;
		bool button12Bool;
		float LeftaxisYValue;
		float LeftaxisXValue;
	
		float RightaxisXValue;
		float RightaxisYValue;
		
		float TriggerValue;

		myRobot.SetSafetyEnabled(true);
		
		while (IsOperatorControl())
		{

			button1Bool = button1.Get();
			SmartDashboard::PutNumber("button1",button1Bool);
			button2Bool = button2.Get();
			SmartDashboard::PutNumber("button2",button2Bool);
			button3Bool = button3.Get();
			SmartDashboard::PutNumber("button3",button3Bool);
			button4Bool = button4.Get();
			SmartDashboard::PutNumber("button4",button4Bool);
			button5Bool = button5.Get();
			SmartDashboard::PutNumber("button5",button5Bool);
			button6Bool = button6.Get();
			SmartDashboard::PutNumber("button6",button6Bool);
			button7Bool = button7.Get();
			SmartDashboard::PutNumber("button7",button7Bool);
			button8Bool = button8.Get();
			SmartDashboard::PutNumber("button8",button8Bool);
			button9Bool = button9.Get();
			SmartDashboard::PutNumber("button9",button9Bool);
			button10Bool = button10.Get();
			SmartDashboard::PutNumber("button10",button10Bool);
			button11Bool = button11.Get();
			SmartDashboard::PutNumber("button11",button11Bool);
			button12Bool = button12.Get();
			SmartDashboard::PutNumber("button12",button12Bool);
			
			
			LeftaxisXValue = stick.GetX();
			SmartDashboard::PutNumber("Joystick1 X Axis",LeftaxisXValue);
			LeftaxisYValue = 0 - stick.GetY();
			SmartDashboard::PutNumber("Joystick1 Y Axis",LeftaxisYValue);
			
			
			RightaxisXValue = stick.GetTwist();
			SmartDashboard::PutNumber("Joystick2 X Axis", RightaxisXValue);
			RightaxisYValue = 0 - stick.GetRawAxis(5);
			SmartDashboard::PutNumber("Joystick2 Y Axis", RightaxisYValue);
			
			TriggerValue = stick.GetThrottle();
			SmartDashboard::PutNumber("Trigger value", TriggerValue);

			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:DjScribbles,项目名称:FRCTeam1967,代码行数:71,代码来源:MyRobot.cpp

示例10: TEST_F

//CommandSequentialGroupTest ported from CommandSequentialGroupTest.java
TEST_F(CommandTest, ThreeCommandOnSubSystem){
	ASubsystem subsystem("Three Command Test Subsystem");
	MockCommand command1;
	command1.Requires(&subsystem);
	MockCommand command2;
	command2.Requires(&subsystem);
	MockCommand command3;
	command3.Requires(&subsystem);


	CommandGroup commandGroup;
	commandGroup.AddSequential(&command1, 1.0 );
	commandGroup.AddSequential(&command2, 2.0 );
	commandGroup.AddSequential(&command3);

	AssertCommandState(command1, 0, 0, 0, 0, 0);
	AssertCommandState(command2, 0, 0, 0, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);

	commandGroup.Start();
	AssertCommandState(command1, 0, 0, 0, 0, 0);
	AssertCommandState(command2, 0, 0, 0, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 0, 0, 0, 0, 0);
	AssertCommandState(command2, 0, 0, 0, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 0);
	AssertCommandState(command2, 0, 0, 0, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);
	Wait(1);//command 1 timeout

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 1, 1, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 0);
	AssertCommandState(command3, 0, 0, 0, 0, 0);
	Wait(2);//command 2 timeout

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 1);
	AssertCommandState(command3, 1, 1 ,1, 0, 0);


	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 1);
	AssertCommandState(command3, 1, 2, 2, 0, 0);
	command3.SetHasFinished(true);
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 1);
	AssertCommandState(command3, 1, 2, 2, 0, 0);

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 1);
	AssertCommandState(command3, 1, 3, 3, 1, 0);

	Scheduler::GetInstance()->Run();
	AssertCommandState(command1, 1, 1, 1, 0, 1);
	AssertCommandState(command2, 1, 2, 2, 0, 1);
	AssertCommandState(command3, 1, 3, 3, 1, 0);


	TeardownScheduler();
}
开发者ID:FRCTeam1967,项目名称:FRCTeam1967,代码行数:75,代码来源:CommandTest.cpp

示例11: main

/**
 *  \brief hsmci_multimedia_card Application entry point.
 *
 *  \return Unused (ANSI-C compatibility).
 */
int main(void)
{
    uint8_t connected = 0;

    /* Disable watchdog */
    WDT_Disable( WDT ) ;
    
    SCB_EnableICache();        
    SCB_EnableDCache();
    TimeTick_Configure();

    /* Output example information*/
    printf("-- MultiMedia Card Example %s --\n\r", SOFTPACK_VERSION);
    printf("-- %s\n\r", BOARD_NAME);
    printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
    bMciID = 0;
    /* Initialize PIO pins */
    _ConfigurePIOs();

    /* Initialize drivers */
    _ConfigureDrivers();


    /* Card insert detection loop */
    for(;;) {

        if (CardIsConnected(bMciID)) {
            if (connected == 0) {
                connected = 1;
                /* Delay before card initialize */
                Wait(300);
                /* Do card test */
                CardInit(bMciID);
                DumpMenu();
            }
        }
        else if (connected) {
            connected = 0;
            printf("** Card Disconnected\n\r");
        }


        if (DBG_IsRxReady()) 
        {
            uint8_t key = DBG_GetChar();
            switch(key) 
            {
                /* Change performance test block size */
                case 'c':
                case 'C': 
                    {   
                        if (performanceMultiBlock >= NB_MULTI_BLOCKS)
                            performanceMultiBlock = 1;
                        else
                            performanceMultiBlock <<= 1;
                        printf("-!- Performance Multi set to %d\n\r", (int)performanceMultiBlock);
                    }
                    break;
                /* Show help information */
                default:
                    if (!connected) 
                    {
                        DumpMenu();
                    }
                    else 
                    {
                        switch(key){
                            /* Dump block contents */
                            case 'd':
                            case 'D':
                                BlockDump(bMciID);  
                                break;
                            /* Initialize the card again */
                            case 'I':  
                            case 'i':    
                                CardInit(bMciID);   
                                break;
                            /* Run test on whole disk */
                            case 't':
                            case 'T':
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDIO)
                                    SdioTest(bMciID);
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDMMC)
                                    DiskTest(bMciID, 1, 1, 1);
                                printf("\n\r");  
                                break;
                            /* Run performance test */
                            case 'P':
                            case 'p':
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDIO)
                                    SdioPerformanceTest(bMciID);
                                if (SD_GetCardType(&sdDrv[bMciID]) & CARD_TYPE_bmSDMMC)
                                    DiskPerformanceTest(bMciID, 1, 1, 0);
                                printf("\n\r");
                                break;
//.........这里部分代码省略.........
开发者ID:BlueSkyGjj,项目名称:SAMV71_softpack,代码行数:101,代码来源:main.c

示例12: while

VOID BL_ThreadPoolWorkThread::Run()
{
    if (CheckQuit())
    {
        return;
    }

    while (TRUE)
    {
        if (CheckQuit())
        {
            CL_BOOL flag = CL_FALSE;
            m_cSyncObj.SynchronizeStart();
            flag = m_cRunTaskList.empty();
            m_cSyncObj.SynchronizeEnd();

            if (flag)
            {
                break;
            }
        }

        while (GetRunTaskCnt() > 0)
        {
            m_cSyncObj.SynchronizeStart();
            m_pCurrentRunTask = m_cRunTaskList.front();
            m_cRunTaskList.pop_front();
            m_cSyncObj.SynchronizeEnd();

            m_sRunSyncObj.SynchronizeStart();
            // Needn't be locked by m_cSyncObj, for the current task point is deleted by this thread.
            if (m_pCurrentRunTask != NULL)
            {
                if (m_pCurrentRunTask->IsCanceled()) {
                    m_pCurrentRunTask->OnAbandon(BL_TASKABANDON_CANCELBYUSER);
                }
                else {
                    RunTask(m_pCurrentRunTask);
                }

            }
            m_sRunSyncObj.SynchronizeEnd();

            m_dwIdleTimeStamp = ::GetTickCount();


            // update group map id map
            m_sGroupIdMapSyncObj.SynchronizeStart();
            if (NULL != m_pCurrentRunTask) {
                INT nGroupId = m_pCurrentRunTask->GetTaskGroupId();
                GroupIdMap::iterator it = m_cGroupIdMap.find(nGroupId);
                if (it != m_cGroupIdMap.end()) {
                    it->second = it->second - 1;
                    if (0 == it->second) {
                        m_cGroupIdMap.erase(it);
                    }
                }
            }
            m_sGroupIdMapSyncObj.SynchronizeEnd();

            m_cSyncObj.SynchronizeStart();
            if (NULL != m_pCurrentRunTask) {
                delete m_pCurrentRunTask;
                m_pCurrentRunTask = NULL;
            }
            m_cSyncObj.SynchronizeEnd();
        }

        // Notify manage thread
        m_pcManager->Notify();

        // Wait for notify
        if (!m_StopFlag)
        {
            Wait();
        }
    }
}
开发者ID:dongxiaozhen,项目名称:lbbNote,代码行数:78,代码来源:BL_ThreadPoolWorkThread.cpp

示例13: WaitUntilLineDetected

void LineFollower :: WaitUntilLineDetected()
{
	while ( not IsLineDetected() )
		Wait( LineFollower::kWaitDelta );
}
开发者ID:Nashoba-Robotics,项目名称:Nashoba-Robotics,代码行数:5,代码来源:LineFollower.cpp

示例14: EventLoop


//.........这里部分代码省略.........

      case ACTID_RESTORE:
        NewSettings(args.from);
        GUINewSettings();
        break;

      case ACTID_ICONS:
      {
        APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS);

        if(item)
        {
          if(xget(item, MUIA_Menuitem_Checked))
          {
            SaveIcons = TRUE;
          }
          else
          {
            SaveIcons = FALSE;
          }
        }
        break;
      }

      case ACTID_HELP:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"AHI",0);
        break;

      case ACTID_GUIDE:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"MAIN",0);
        break;

      case ACTID_HELPINDEX:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"Concept Index",0);
        break;

      case ACTID_UNIT:
        FillUnit();
        NewUnit(xget(MUIUnit,MUIA_Cycle_Active));
        GUINewUnit();
        break;

      case ACTID_MODE:
        FillUnit();
        NewMode(xget(MUIList, MUIA_List_Active));
        GUINewMode();
        break;
        
      case ACTID_PLAY:
      {
        int              unit_id;
        struct UnitNode* unit;

        FillUnit();
        unit_id = xget( MUIUnit, MUIA_Cycle_Active );
        unit    = (struct UnitNode *) GetNode( unit_id, UnitList );
        
        PlaySound( &unit->prefs );
        break;
      }

      case ACTID_DEBUG:
      case ACTID_SURROUND:
      case ACTID_ECHO:
      case ACTID_CPULIMIT:
      case ACTID_CLIPMV:
      case ACTID_ACTIME:
      {
        ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
        ULONG clip = FALSE, actime = 0;

        get(MUIDebug, MUIA_Cycle_Active, &debug);
        get(MUISurround, MUIA_Cycle_Active, &surround);
        get(MUIEcho, MUIA_Cycle_Active, &echo);
        get(MUIClipvol, MUIA_Cycle_Active, &clip);
        get(MUICpu, MUIA_Numeric_Value, &cpu);
        get(MUIACTime, MUIA_Numeric_Value, &actime);

        globalprefs.ahigp_DebugLevel       = debug;
        globalprefs.ahigp_DisableSurround  = surround;
        globalprefs.ahigp_DisableEcho      = (echo == 2);
        globalprefs.ahigp_FastEcho         = (echo == 1);
        globalprefs.ahigp_MaxCPU           = ((cpu << 16) + 50) / 100;
        globalprefs.ahigp_ClipMasterVolume = clip;
        globalprefs.ahigp_AntiClickTime    = ((actime << 16) + 500) / 1000;

        break;
      }

      default:
        if (sigs)
        {
          sigs = Wait(sigs | SIGBREAKF_CTRL_C);
          if (sigs & SIGBREAKF_CTRL_C)
          return;
        }
        break;
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:101,代码来源:gui_mui.c

示例15: PlaySineEverywhere

int
PlaySineEverywhere( void ) {
  int   rc = RETURN_OK;
  int   sine_length = 44100 / 100;
  BYTE* sine_m8s;
  BYTE* sine_s8s;
  WORD* sine_s16s;
  WORD* sine_m16s;
  LONG* sine_s32s;
  LONG* sine_m32s;

  sine_m8s  = AllocVec( 1 * sizeof( BYTE ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  sine_s8s  = AllocVec( 2 * sizeof( BYTE ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  sine_m16s = AllocVec( 1 * sizeof( WORD ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  sine_s16s = AllocVec( 2 * sizeof( WORD ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  sine_m32s = AllocVec( 1 * sizeof( LONG ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  sine_s32s = AllocVec( 2 * sizeof( LONG ) * sine_length, MEMF_ANY | MEMF_PUBLIC );
  
  if( sine_m8s != NULL &&
      sine_s8s != NULL &&
      sine_m16s != NULL &&
      sine_s16s != NULL &&
      sine_m32s != NULL &&
      sine_s32s != NULL ) {
    ULONG mode = AHI_INVALID_ID;
    int   i;

    for( i = 0; i < sine_length; ++i ) {
      double value = sin( i * 2 * M_PI / sine_length );

      sine_m8s[ i ] = (BYTE) ( SCHAR_MAX * value );
      sine_m16s[ i ] = (WORD) ( SHRT_MAX * value );
      sine_m32s[ i ] = (LONG) ( LONG_MAX * value );

      sine_s8s[ i * 2 + 0 ] = (BYTE) ( SCHAR_MAX * value );
      sine_s8s[ i * 2 + 1 ] = (BYTE) ( SCHAR_MAX * value );
      sine_s16s[ i * 2 + 0 ] = (WORD) ( SHRT_MAX * value );
      sine_s16s[ i * 2 + 1 ] = (WORD) ( SHRT_MAX * value );
      sine_s32s[ i * 2 + 0 ] = (LONG) ( LONG_MAX * value );
      sine_s32s[ i * 2 + 1 ] = (LONG) ( LONG_MAX * value );
    }

    while( rc == RETURN_OK &&
	   ( mode = AHI_NextAudioID( mode ) ) != AHI_INVALID_ID ) {
      struct AHIAudioCtrl* actrl;
      char                 name[ 64 ];
      struct Hook          sound_hook = {
	{ NULL, NULL },
	HookEntry,
	(HOOKFUNC) SoundFunc,
	FindTask( NULL )
      };
    
      AHI_GetAudioAttrs( mode, NULL,
			 AHIDB_Name, (ULONG) &name,
			 AHIDB_BufferLen, 64,
			 TAG_DONE );
    
      printf( "Mode 0x%08lx: %s\n", mode, name );

      actrl = AHI_AllocAudio( AHIA_AudioID,   mode,
			      AHIA_MixFreq,   44100,
			      AHIA_Channels,  1,
			      AHIA_Sounds,    6,
			      AHIA_SoundFunc, (ULONG) &sound_hook,
			      AHIA_UserData,  0,
			      TAG_DONE );

      if( actrl != NULL ) {
	struct AHISampleInfo sample_m8s  = { AHIST_M8S,  sine_m8s,  sine_length };
	struct AHISampleInfo sample_s8s  = { AHIST_S8S,  sine_s8s,  sine_length };
	struct AHISampleInfo sample_m16s = { AHIST_M16S, sine_m16s, sine_length };
	struct AHISampleInfo sample_s16s = { AHIST_S16S, sine_s16s, sine_length };
	struct AHISampleInfo sample_m32s = { AHIST_M32S, sine_m32s, sine_length };
	struct AHISampleInfo sample_s32s = { AHIST_S32S, sine_s32s, sine_length };
	
	if( AHI_LoadSound( 0, AHIST_SAMPLE, &sample_m8s,  actrl) == AHIE_OK &&
	    AHI_LoadSound( 1, AHIST_SAMPLE, &sample_s8s,  actrl) == AHIE_OK &&
	    AHI_LoadSound( 2, AHIST_SAMPLE, &sample_m16s, actrl) == AHIE_OK &&
	    AHI_LoadSound( 3, AHIST_SAMPLE, &sample_s16s, actrl) == AHIE_OK &&
	    AHI_LoadSound( 4, AHIST_SAMPLE, &sample_m32s, actrl) == AHIE_OK &&
	    AHI_LoadSound( 5, AHIST_SAMPLE, &sample_s32s, actrl) == AHIE_OK ) {

	  AHI_Play( actrl,
		    AHIP_BeginChannel, 0,
		    AHIP_Sound,        0,
		    AHIP_Freq,         44100,
		    AHIP_Vol,          0x10000,
		    AHIP_Pan,          0x00000,
		    AHIP_EndChannel,   0,
		    TAG_DONE );

	  // Now, when everything is "armed", lets start processing.

	  SetSignal( 0, SIGF_SINGLE );

	  if( AHI_ControlAudio( actrl,
				AHIC_Play, TRUE,
				TAG_DONE ) == AHIE_OK ) {
	    Wait( SIGF_SINGLE );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:101,代码来源:PlaySineEverywhere.c


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