mhash: Prepare the GC daemon to run concurrently with other threads.
authorMatt Birkholz <puck@birchwood-abbey.net>
Sun, 12 Jul 2015 22:10:53 +0000 (15:10 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Mon, 17 Aug 2015 23:52:58 +0000 (16:52 -0700)
src/mhash/mhash.scm

index fc0da45a467288c516567841912a4e9a232b297c..740123e086579c5bf2a03bbee63cfdfddd92170e 100644 (file)
@@ -115,10 +115,13 @@ USA.
                (loop next prev)))))))
 
 (define (cleanup-mhash-contexts)
-  (if (not (thread-mutex-owner mhash-contexts-mutex))
-      (begin
-       (cleanup-contexts)
-       (cleanup-hmac-contexts))))
+  (with-thread-mutex-try-lock
+   mhash-contexts-mutex
+   (lambda ()
+     (cleanup-contexts)
+     (cleanup-hmac-contexts))
+   (lambda ()
+     unspecific)))
 
 (define (mhash-name->id name procedure)
   (let ((n (vector-length mhash-algorithm-names)))