(define gtk-thread #f)
+;; Number of GCs between applications of trigger-secondary-gc-daemons!
+(define secondary-gc-rate 100)
+
;;; With the following thread always running, the runtime system
;;; should no longer use wait-for-io, nor need to signal
;;; condition-type:no-thread!
(create-thread
#f (lambda ()
(let ((self (current-thread))
- (done-tick 0))
+ (done-tick 0)
+ (next-secondary-tick secondary-gc-rate))
(let gtk-thread-loop ()
(without-interrupts
(lambda ()
(if (fix:< done-tick gc-tick)
(begin
(run-gc-cleanups)
- (set! done-tick gc-tick))))))
+ (set! done-tick gc-tick)))
+ (if (fix:< next-secondary-tick gc-tick)
+ (begin
+ (trigger-secondary-gc-daemons!)
+ (set! next-secondary-tick
+ (fix:+ gc-tick secondary-gc-rate)))))))
(without-interrupts
(lambda ()
(let ((time (if (thread/next self)