mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
time: remove unnecessary yield
This commit is contained in:
+1
-5
@@ -213,10 +213,6 @@ time_add :: proc(t: Time, d: Duration) -> Time {
|
|||||||
return Time{t._nsec + i64(d)}
|
return Time{t._nsec + i64(d)}
|
||||||
}
|
}
|
||||||
|
|
||||||
yield :: proc "contextless" () {
|
|
||||||
_yield()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accurate sleep borrowed from: https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
|
// Accurate sleep borrowed from: https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
|
||||||
accurate_sleep :: proc(d: Duration) {
|
accurate_sleep :: proc(d: Duration) {
|
||||||
to_sleep, estimate, mean, m2, count: Duration
|
to_sleep, estimate, mean, m2, count: Duration
|
||||||
@@ -245,7 +241,7 @@ accurate_sleep :: proc(d: Duration) {
|
|||||||
start := tick_now()
|
start := tick_now()
|
||||||
for to_sleep > tick_since(start) {
|
for to_sleep > tick_since(start) {
|
||||||
// prevent the spinlock from taking the thread hostage, still accurate enough
|
// prevent the spinlock from taking the thread hostage, still accurate enough
|
||||||
yield()
|
_yield()
|
||||||
// NOTE: it might be possible that it yields for too long, in that case it should spinlock freely for a while
|
// NOTE: it might be possible that it yields for too long, in that case it should spinlock freely for a while
|
||||||
// TODO: needs actual testing done to check if that's the case
|
// TODO: needs actual testing done to check if that's the case
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user