multithreading question

  • Thread starter Thread starter PJ6
  • Start date Start date
P

PJ6

I drive my game's physics engine using a simple loop running on its own
thread. It invokes Thread.Sleep(1) when processing takes little or no time
(under 4ms) to allow real time to catch up. For heavier loads the loop uses
bigger timeslices, up to 20ms, with no sleeps.

Since this is a multithreaded application, I decided to break out CHESS to
test the object (render) buffer for problems. But CHESS hates
Thread.Sleep() - it fails any test that hits one, calls it a livelock.

I ended up switching out the original realtime loop with a high resolution
multimedia timer, but I don't feel like it was a design improvement. I know
sleeping threads should generally be avoided, but what about in games? Using
a timer seems more... clumsy.

Paul
 
Never mind, dumb question. I needed to pump the engine directly from a
thread created in the test. The holistic test was cool but not what I
needed.
 
Back
Top