Gabi wrote:The issue is not just the precision of Thread.sleep (which is pretty bad in general - RealtimeThread.sleep is much better!) but the semantics. A sleep (ignoring inaccuracies) is a way to schedule with a fixed-delay, whereas you use periodic threads to schedule at a fixed-rate. The difference being that in fixed-rate the period is the time between successive starts of the periodic activity, whereas in fixed-delay the "period" is the delay between the end of one session of "periodic" activity and the start of the next. (See also the definition of fixed-rate vs fixed-delay in the java.util.Timer javadocs).
for our communication module we do not need precise correctness.
if we put under Thread.Sleep(n) for example 2000 and it was actually 2100 its not a problem for us.