darwin: dladdr can deadlock the GC
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 7 Dec 2011 13:41:45 +0000 (15:41 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 7 Dec 2011 17:29:25 +0000 (19:29 +0200)
  Needs to be always called inside WITHOUT-GCING since it grabs locks, and is
  /sometimes/ called inside WITHOUT-GCING.

src/code/foreign.lisp

index 8c32729..a735e76 100644 (file)
@@ -139,7 +139,10 @@ if the symbol isn't found."
                                (symbol-address unsigned)))
                  (dladdr (function unsigned unsigned (* (struct dl-info)))
                          :extern "dladdr"))
-      (let ((err (alien-funcall dladdr addr (addr info))))
+      (let ((err (without-gcing
+                   ;; On eg. Darwin GC can could otherwise interrupt
+                   ;; the call while dladdr is holding a lock.
+                   (alien-funcall dladdr addr (addr info)))))
         (if (zerop err)
             nil
             (slot info 'symbol))))