3 ms·
Writing a program for Haiku, the timing had to be very precise. The code work fine most of the time abut about one in a million runs (the code was in a tight l
by ecpottinger 5y ago
Writing a program for Haiku, the timing had to be very precise. The code work fine most of the time abut about one in a million runs (the code was in a tight loop) there would be a mis-timing. I went over the code time over time and could not find a problem.
Finally, I added a timing counter to see what happened and then filter for the mis-timings.
Turns out there were multiple interrupts happening, and each interrupt was short enough that it did not interfere with my program. But every now and then multiple interrupts occurred at the same time, and by the time they all got serviced the timing was way off.
Solution, re-code the loop to be an interrupt too.