summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-02-17 14:39:59 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-02-17 14:39:59 -0500
commitc23b31bdc0acd94adcbf5c4bb87b0022b0591959 (patch)
treeb3851ce2ff6d69defeb912ef16c8e627ac1e7b90
parent77007e55bdf10e498912701f590f33d49efa4c09 (diff)
Rewrite define-guardian to avoid 'after-cg-hook'.
* 2d/helpers.scm (define-guardian): Don't use 'after-gc-hook'.
-rw-r--r--2d/helpers.scm18
1 files changed, 7 insertions, 11 deletions
diff --git a/2d/helpers.scm b/2d/helpers.scm
index a9d2dfe..6106d90 100644
--- a/2d/helpers.scm
+++ b/2d/helpers.scm
@@ -45,14 +45,10 @@ within the guardian is GC'd. Reaping is ensured to happen from the
same thread that is running the game loop."
(begin
(define name (make-guardian))
- (add-hook! after-gc-hook
- (lambda ()
- (define (reap)
- (let ((obj (name)))
- (when obj
- (reaper obj)
- (reap))))
- ;; Scheduling the reaping procedure in the game
- ;; loop's agenda ensures that the reaping will be
- ;; done in the main thread.
- (schedule game-agenda reap)))))
+ (schedule-interval game-agenda
+ (lambda ()
+ (let reap ((obj (name)))
+ (when obj
+ (reaper obj)
+ (reap (name)))))
+ 1)))