All pastes #538309 Raw Edit

Something

public text v1 · immutable
#538309 ·published 2007-06-05 00:20 UTC
rendered paste body
tests/threads.0 checks that "fast" and "slow" threads are interleaved as 
expected.  It creates a fast thread and a slow thread with a given ratio
(10:1).  The fast thread increments a counter, and the slow thread clears it.
The "checkresult" script tests that, after an initial desynched time, the 
output goes 1, 2, ..., 9, 10, 1, 2, ..., 9, 10, etc.

However, on x86-64 there are failures.  I think it has to do with the
granularity of ticks and bad luck in rounding.

Example:
Interrupt clock = 32ns
Thread          Request         Ticks           Actual
fast            10uS            312             9.984us
slow            100uS           3125            100us

Because 'fast' is a little faster than 10x 'slow', the fast thread will 
sometimes run 11 times between runs of 'slow'.

Should I change the test (and if so, how)?  Or is RTAPI supposed to guarantee that a 100uS 
(requested) thread is run exactly 1/10 as often as a 10uS (requested)
thread?