View Single Post
  #7   Spotlight this post!  
Unread 16-02-2011, 09:30
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
isNewControlData() vs. waitForData()

The both get the job done, but there are differences:
  • isNewControlData() needs to be polled to determine when new data is ready
  • isNewControlData() always clears the internal state "newControlData", so you can't have two threads waiting for new data. Note that the IterativeRobot class calls isNewControlData(), so IterativeRobots can't really call it anywhere else.
  • waitForData() uses the standard Java wait/notify routines, and blocks the caller until data is ready (or the time expires).
Reply With Quote