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


C++ Task::Stop方法代码示例

本文整理汇总了C++中Task::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::Stop方法的具体用法?C++ Task::Stop怎么用?C++ Task::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task的用法示例。


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

示例1: Execute

int Kernel::Execute() {
    
    LOGGER.Write(LOG_APP, "Kernel executing.");
    
    while (taskList.size()) {
        Task *t;
        std::list< MMPtr<Task> >::iterator it;
        
        for (it = taskList.begin(); it != taskList.end(); ) {
            t = (*it);
            it++;
            if (!t->canKill) t->Update();
        }
        
        for (it = taskList.begin(); it != taskList.end(); ) {
            t = (*it);
            it++;
            if (t->canKill) {
                t->Stop();
                taskList.erase(t->pos);
                
                std::string rslt = "Task ID: " + std::to_string(t->getId()) + " removed.";
                LOGGER.Write(LOG_APP, rslt.c_str());
                
                t = 0;
            }
        }
      
        //TODO: Move this to a garbage collection task.
        MMObject::collectGarbage();
    }
    return 0;
}
开发者ID:mbaptist34,项目名称:physics-engine,代码行数:33,代码来源:Kernel.cpp

示例2: OperatorControl

	void OperatorControl(void)
	{
		myRobot->SetSafetyEnabled(false);
		
		LEDLights (true); //turn camera lights on
		
		shooterspeedTask->Start((UINT32)this); //start counting shooter speed
		
		kickerTask->Start((UINT32)this); //turns on the kicker task
		
		kicker_in_motion = false;
				
		while (IsOperatorControl() && !IsDisabled())
		{
			
			if (ControllBox->GetDigital(3)) //turn tracking on with switch 3 on controll box
			{ 
				tracking(ControllBox->GetDigital(7));
			}
			else 
			{
				myRobot->TankDrive(leftstick, rightstick); //if tracking is off, enable human drivers
				Wait(0.005);	// wait for a motor update time
			}

			Shooter_onoff=ControllBox->GetDigital(4); //shoot if switch 4 is on
		
			ballgatherer(ControllBox->GetDigital(5), rightstick->GetRawButton(10));
			 
			kicker_onoff=lonelystick->GetRawButton(1);
			
			bridgeboot(ControllBox->GetDigital(6));
			
			kicker_cancel=lonelystick->GetRawButton(2);
			
			//kicker_down=rightstick->GetRawButton(11));
			
		}
		
		
		LEDLights (false);
		shooterspeedTask->Stop();
		kickerTask->Stop();
		ballgatherer(false, false);
		kickermotor->Set(Relay::kOff);
	}
开发者ID:preuss812,项目名称:FRC_2012,代码行数:46,代码来源:MyRobot.cpp

示例3: Autonomous

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		myRobot->SetSafetyEnabled(false);
		
		//shooter on
		
		kickerTask->Start((UINT32)this);
		shooterspeedTask->Start((UINT32)this);
		
		Shooter_onoff=true;
				//if (speederror < 10);
		
		//track+adjust
		
		LEDLights(true);
		//turn tracking on
		//while (tracking(false) == false) {
	//	}
		//if while returns true, then shoot
		//might have to wait for encoder once capabilities have been enabled
		
		Wait(2.0);
  		AutonomousShooting(true);
  		AutonomousShooting(true);
  		AutonomousShooting(true);
 
		
		//load
/*
		Wait(1.0);
		kicker_onoff = true;
		while(kicker_in_motion == false) {
			Wait(0.005);
		printf ("kicker_onoff is false, kicker_onoff is true\n");
		}
		
		kicker_onoff = false;
		while (kicker_in_motion == true) {
			Wait(0.005);
		printf ("kicker_in_motion is true, kicker_onoff is false\n");
		}		
		
		//shoot, by itself, because the shooter motor was already on. 
		
		//gather
		
		ballgatherer(true, false);
		Wait(4.0);
		printf ("ballgatherer on\n");
		ballgatherer(false, false);
		printf ("ballgatherer off\n");
		
		//load
		
		kicker_onoff = true;
			while(kicker_in_motion == false) {
				Wait(0.005);
			printf ("kicker_in_motion is false, kicker_onoff is true\n");
			}
		
		kicker_onoff = false;
			while (kicker_in_motion == true) {
				Wait(0.005);
			printf ("kicker_in_motion is true, kicker_onoff is false \n");
			}	
		
			//shoot *does by itself because the shooter is already on, AGAIN! :D 
			
			ballgatherer(true, false);
			Wait(4.0);
			printf ("ballgatherer on\n");
			ballgatherer(false, false);
			printf ("ballgatherer off\n");
		
			kicker_onoff = true;
			while(kicker_in_motion == false) {
				Wait(0.005);
			printf ("kicker_onoff is false, kicker_onoff is true\n");
			}
			
			kicker_onoff = false;
			while (kicker_in_motion == true) {
				Wait(0.005);
			printf ("kicker_in_motion is true, kicker_onoff is false\n");
			}		
			
			//shoot, by itself, because the shooter motor was already on. 
			
			//gather
		
			
	*/
	
		kickerTask->Stop();
		shooterspeedTask->Stop();
		Shooter_onoff=false;
		
//.........这里部分代码省略.........
开发者ID:preuss812,项目名称:FRC_2012,代码行数:101,代码来源:MyRobot.cpp

示例4:

	~RobotSystem() {
		debug("Deleting robot");
		updateCAN.Stop();
		cameraTask.Stop();
	}
开发者ID:nerdherd,项目名称:FRC-2011,代码行数:5,代码来源:MyRobot.cpp


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