preciseWait flag on client
This commit is contained in:
parent
5fb6d817fc
commit
b1b5b598f0
@ -139,6 +139,8 @@ class StarboundClient : Closeable {
|
||||
|
||||
var fullbright = true
|
||||
|
||||
var preciseWait = false
|
||||
|
||||
var clientTerminated = false
|
||||
private set
|
||||
|
||||
@ -741,14 +743,17 @@ class StarboundClient : Closeable {
|
||||
// try to sleep until next frame as precise as possible
|
||||
while (diff > 0L) {
|
||||
executeQueuedTasks()
|
||||
|
||||
if (diff >= 1_500_000L) {
|
||||
LockSupport.parkNanos(1_000_000L)
|
||||
} else {
|
||||
Thread.yield()
|
||||
}
|
||||
|
||||
diff = nextRender - System.nanoTime()
|
||||
|
||||
if (preciseWait) {
|
||||
if (diff >= 1_500_000L) {
|
||||
LockSupport.parkNanos(1_000_000L)
|
||||
} else {
|
||||
Thread.yield()
|
||||
}
|
||||
} else {
|
||||
LockSupport.parkNanos(diff)
|
||||
}
|
||||
}
|
||||
|
||||
val mark = System.nanoTime()
|
||||
|
Loading…
Reference in New Issue
Block a user