Would it be possible to encase the comparison/stopping/starting of Timer in a critical Section?
I'd probably go with a GetTickCount64, saving the TickCount as my new starting point if OldValue<>NewValue. Then it's basic math
I tend to overuse Now(), despite being very unhappy with some of its implementation details (forces an indeterminate amount of floating point maths into a loop, and having progressively less precision as we move away from the epoch).
However unlike integer-based solutions it does have the advantage of being effectively immune to the risk of rollover in the comparison.
MarkMLl
What would be the best way to implement a command timeout?Command to what? External device or the operating system?
I want to repeatedly call a function and if its result doesn't change after 2 seconds then fail?Call the function with what frequency?