LaKraven / LKSL

LaKraven Studios Standard Library
http://otapi.com
Other
51 stars 15 forks source link

Replace Tick Rate Limiter algorithm! #25

Closed LaKraven closed 9 years ago

LaKraven commented 9 years ago

The current model reduces precision/resolution on Windows to 1ms between rate-limited Ticks. This is unacceptable.

New Algorithm should work like this:

1) Determine how many Milliseconds we can allow the Thread to rest for between the current and next Tick (this may be 0, if the rest time is less than 1ms) 2) Sleep for that duration 3) For the remaining time, spin a "Live Wait" (which will keep the Thread active, but will be precise to the absolute precision of the system clock).

LaKraven commented 9 years ago

Sorted