Thread: Tasks?
View Single Post
  #6   Spotlight this post!  
Unread 27-02-2010, 09:58
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Tasks?

You have to be careful when using tasks. Tasks are run concurrently. In a preemptive multi-tasking environment, you need to use semaphores to protect against resources being accessed by concurrent tasks (take a look at the notifier as an example). If you are not familiar with this concept, I would advise against using them. You can easily implement the effect of tasks by using cooperative multi-tasking. IterativeRobot class is such an example. In cooperative multi-tasking, tasks can only be switched away if the task chooses to do so. For example, in IterativeRobot, consider AutonomousPeriodic is a task. It got run in every StartCompetition loop, just like a task got run periodically. But the difference is that you are guaranteed that nobody changes the robot state while you are executing your AutonomousPeriodic code.
__________________
Reply With Quote