Reset dld (.so) handles on restore.
authorTaylor R Campbell <campbell@mumble.net>
Mon, 3 Nov 2014 20:43:17 +0000 (20:43 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Mon, 3 Nov 2014 20:43:17 +0000 (20:43 +0000)
src/runtime/io.scm

index c3866bbaa0f538f4bdbd1aab6ae7af09559b69b2..93f23e891ca1737ce913567c652301754793a52f 100644 (file)
@@ -44,7 +44,8 @@ USA.
                           directory-channel/descriptor
                           set-directory-channel/descriptor!))
   (initialize-select-registry!)
-  (set! dld-handles '())
+  (reset-dld-handles!)
+  (add-event-receiver! event:after-restore reset-dld-handles!)
   unspecific)
 
 (define-structure (channel (constructor %make-channel))
@@ -736,6 +737,10 @@ USA.
 \f
 (define dld-handles)
 
+(define (reset-dld-handles!)
+  (set! dld-handles '())
+  unspecific)
+
 (define (dld-unload-file handle)
   (guarantee-dld-handle handle 'DLD-UNLOAD-FILE)
   (without-interrupts
@@ -767,14 +772,4 @@ USA.
   (find-matching-item dld-handles predicate))
 
 (define (all-dld-handles)
-  (list-copy dld-handles))
-
-(define (unload-all-dld-object-files)
-  (without-interrupts
-   (lambda ()
-     (let loop ()
-       (if (pair? dld-handles)
-          (let ((handle (car dld-handles)))
-            (set! dld-handles (cdr dld-handles))
-            (%dld-unload-file handle)
-            (loop)))))))
\ No newline at end of file
+  (list-copy dld-handles))
\ No newline at end of file