mhash: Assume GC daemon must lock out other threads.
authorMatt Birkholz <puck@birchwood-abbey.net>
Fri, 10 Jul 2015 02:17:10 +0000 (19:17 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Fri, 10 Jul 2015 02:17:10 +0000 (19:17 -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)))