ce11a64d569c

Start timer thread
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 26 Dec 2016 14:15:14 -0500
parents 103e7794c04a
children 0f57fe590e90
branches/tags (none)
files content/blog/2016/12/chip8-sound.markdown

Changes

--- a/content/blog/2016/12/chip8-sound.markdown	Mon Dec 26 12:57:52 2016 -0500
+++ b/content/blog/2016/12/chip8-sound.markdown	Mon Dec 26 14:15:14 2016 -0500
@@ -155,6 +155,18 @@
 We could have used a lock from bordeaux threads to manage this portably (though
 more slowly), but I wanted to play around with SBCL's concurrency stuff.
 
+Finally we just need to start up the timer thread:
+
+```lisp
+(defun run (rom-filename)
+  (let ((chip (make-chip)))
+    (setf *c* chip)
+    (load-rom chip rom-filename)
+    (bt:make-thread (curry #'run-cpu chip))
+    (bt:make-thread (curry #'run-timers chip)) ; NEW
+    (chip8.gui.screen::run-gui chip)))
+```
+
 [SBCL manual]: http://www.sbcl.org/manual/#Atomic-Operations
 
 ## Sound From Scratch