Tinyclr Main() while true loop

I would like to ask if there is a recommended
Thread sleep interval to use in the while loop?

while (true)
Thread.Sleep(50); // Give it some time

I assume this is a reasonable question to ask.

If there is a recommendation, why?


I have been using 20ms

Thank You.

If it’s good for you then it’s got to be good!
I’ll be using 20!

20ms is the old netmf timesllice factor, so that’s why it (was) a good choice, it gave the full opportunity to another thread. Is that still similarly operating in TinyCLR?

The actual above pattern, unless there’s other things in the WHILE loop, isn’t doing anything useful so the old guidance was to put the thread to deep sleep by using Timeout.Infinite as the sleep duration…

1 Like