glib/glib-thread: Run-glib-daemons with glib lock.
authorMatt Birkholz <matt@birchwood-abbey.net>
Fri, 16 Mar 2018 03:03:19 +0000 (20:03 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Fri, 16 Mar 2018 03:03:19 +0000 (20:03 -0700)
src/glib/glib-thread.scm

index a274c3b164e05da9bd763431ef22eb647eb6a0aa..fc1939bc9d97263a3724c28e91c9a1726772bd5c 100644 (file)
@@ -52,23 +52,22 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
                    (done-tick 0)
                    (next-secondary-tick secondary-gc-rate))
                (let glib-thread-loop ()
-                 (let ((gc-tick (car (gc-timestamp))))
-                   (if (fix:< done-tick gc-tick)
-                       (with-glib-lock
-                        (lambda ()
-                          (%trace ";run-glib cleaning up\n")
-                          (run-glib-cleanups)
-                          (%trace ";run-glib clean up done\n")
-                          (set! done-tick gc-tick))))
-                   (if (fix:< next-secondary-tick gc-tick)
-                       (begin
-                         (%trace ";run-glib secondary-gc daemons\n")
-                         (run-glib-daemons)
-                         (%trace ";run-glib secondary-gc daemons done\n")
-                         (set! next-secondary-tick
-                               (fix:+ gc-tick secondary-gc-rate)))))
                  (with-glib-lock
                   (lambda ()
+                    (let ((gc-tick (car (gc-timestamp))))
+                      (if (fix:< done-tick gc-tick)
+                          (begin
+                            (%trace ";run-glib cleaning up\n")
+                            (run-glib-cleanups)
+                            (%trace ";run-glib clean up done\n")
+                            (set! done-tick gc-tick)))
+                      (if (fix:< next-secondary-tick gc-tick)
+                          (begin
+                            (%trace ";run-glib secondary-gc daemons\n")
+                            (run-glib-daemons)
+                            (%trace ";run-glib secondary-gc daemons done\n")
+                            (set! next-secondary-tick
+                                  (fix:+ gc-tick secondary-gc-rate)))))
                     (with-thread-timer-stopped
                      (lambda ()
                        (let ((time (or (and (thread/next self) 0)