summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-12-09 14:45:58 -0500
committerDavid Thompson <dthompson2@worcester.edu>2018-12-09 14:45:58 -0500
commitc2f9c9615e28fb009f1e0537704645526549b15f (patch)
tree67ecf1bdcfaf9911a09f668ace98ed20b52959ed
parentbca534837b1ec406f1152f93b21c7206606d205c (diff)
game-loop: Sleep thread a bit to avoid 100% CPU usage.
-rw-r--r--chickadee.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/chickadee.scm b/chickadee.scm
index f6894b0..386e99f 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -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.