How to implement precise game loop frame limiting in C#?
问题 I'm attempting to implement a game loop frame limiter in a game engine written in C#. I was told Thread.Sleep requires a few milliseconds to even execute Thread.Sleep(0) , and would miss the target milliseconds a bit. It is thus not precise enough for what I need, because the target frame rate can require the engine to sit and wait for 1 millisecond. I'm not sure I should be using Thread.SpinWait in this, as there can also be situations where the engine needs to wait for 10 milliseconds, and