game-loop: Sleep thread a bit to avoid 100% CPU usage.
authorDavid Thompson <dthompson2@worcester.edu>
Sun, 9 Dec 2018 19:45:58 +0000 (14:45 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Sun, 9 Dec 2018 19:45:58 +0000 (14:45 -0500)
chickadee.scm

index f6894b0..386e99f 100644 (file)
@@ -83,7 +83,9 @@
                   ;; that was spent handling the error.
                   (if (with-error-handling error (update timestep))
                       (loop (time) 0)
-                      (update-loop (- buffer timestep)))
+                      (begin
+                        (usleep 1)
+                        (update-loop (- buffer timestep))))
                   (begin
                     ;; We render upon every iteration of the loop, and
                     ;; thus rendering is decoupled from updating.