View Single Post
  #11   Spotlight this post!  
Unread 08-01-2014, 11:31
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: How to make timed sequences in java?

Quote:
Originally Posted by Ether View Post
Do you think it's less efficient than time-slicing a separate thread?


Hard to say without looking in detail. You have the constant tests for setting and checking vs. the context switch to handle the thread. If the piston is used exactly once and never again the thread could be deleted. If its used many times the context switching could become onerous.
There are also many opportunuties to do threads badly. For instance if it was coded to check the time constantly rather than sleeping the whole duration it would be enormously worse. For teams that need to ask how to wait for something polling probably has the fewer pitfalls.