Using Timeout timer UNO

  1. I have to use timeout method in program. E.g if for 10ms particular task does not happen then timeout.One method is to do this:

unsigned long DelayTimeOut;
DelayTimeOut = millis() + 1000; /* 1 sec timeout */
while (millis() < DelayTimeOut)
{
}

  1. problem with this approach may be:
    a) it rolls off after 50 days as here:millis() - Arduino Reference
    Also micro() rolls off in 70 minutes. So it will provide error in case of roll off.

b) second this approac, calls millis(), regularly, it reads atomic value of internal counter overflow everytime.
Is it a good idea that it a loop continuoulsy interrupts are switched on/off.

  1. What is best way to do this?

it rolls off after 50 days

The rollover will not affect timing if you use

while (millis() - startTime >= period)
{
  //I hope that there is code here doing something otherwise you may just have well used delay()
}

More answer is already in your OTHER THREAD on the same topic.

To start more than one thread on the same basic subject is called cross-posting, very frowned upon.

So it will provide error in case of roll off.

Only if you don't write it correctly

(We call it a "roll-over" - "roll-off" is something completely different.)