The link you provided gives a very similar example to mine and "assumes the do_something() execution time is well below the system tick period and that my_thread() is not preempted":
An obvious solution is to write something like this:
msg_t my_thread(void *param) {
while (TRUE) {
do_something();
chThdSleepMilliseconds(1000); /* Fixed interval.*/
}
}
This example works well assuming that the do_something() execution time is well below the system tick period and that my_thread() is not preempted by other threads that could insert long intervals.
If the above conditions are not satisfied you may have do_something() executed at irregular intervals, for example:
T0…T0+1000…T0+2002…T0+3002…T0+4005…
Also note that the error increases over time and this kind of behavior can lead to anomalies really hard to debug.
The tick preemption time is an implementation detail and your program should not depend on it to behave correctly.
He even suggests reliable alternatives to the code above.
In my post I didn't say that you cannot implement that program correctly with an RTOS.
My point is that it is not as easy as the manuals usually state (e.g., "Look how easy is to have two blinking leds.").
I corrected the ChibiOS implementation to sleep 10000ms in the main thread (avoiding the overflow) and changed the blinking threads to HIGHPRIO.
The behavior is exactly the same (at least visually).
In the DuinOS implementation I changed their priorities and the behavior is similar (still not synchronized).
That said, I also cannot agree that blinking leds should run with the highest priority in an application.
I wonder if someone can reproduce these tests.