From 2643d871d46653d4a677db8faaddb718bb3db3ff Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 11 Jul 2015 13:34:47 -0700 Subject: [PATCH] Ignore errors from close-channel or delete-subprocess. --- src/runtime/thread.scm | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/runtime/thread.scm b/src/runtime/thread.scm index 496a33560..4e549489b 100644 --- a/src/runtime/thread.scm +++ b/src/runtime/thread.scm @@ -789,12 +789,18 @@ USA. (%maybe-toggle-thread-timer)))) (define (deregister-io-descriptor descriptor close-descriptor!) - (with-thread-lock - (lambda () - (%deregister-io-descriptor* descriptor) - (close-descriptor!)))) - -(define (%deregister-io-descriptor* descriptor) + (let ((error? + (with-thread-lock + (lambda () + (%deregister-io-descriptor descriptor) + (ignore-errors + (lambda () + (close-descriptor!) + #f)))))) + (if error? + (signal-condition error?)))) + +(define (%deregister-io-descriptor descriptor) (let dloop ((dentry io-registrations)) (cond ((not dentry) unspecific) @@ -1158,15 +1164,21 @@ USA. (delq! registration subprocess-registrations))))) (define (deregister-subprocess subprocess delete-subprocess!) - (with-thread-lock - (lambda () - (set! subprocess-registrations - (filter! - (lambda (registration) - (not (eq? subprocess - (subprocess-registration/subprocess registration)))) - subprocess-registrations)) - (delete-subprocess!)))) + (let ((error? + (with-thread-lock + (lambda () + (set! subprocess-registrations + (filter! + (lambda (registration) + (not (eq? subprocess (subprocess-registration/subprocess + registration)))) + subprocess-registrations)) + (ignore-errors + (lambda () + (delete-subprocess!) + #f)))))) + (if error? + (signal-condition error?)))) (define (%deregister-subprocess-events thread) (%assert-locked '%deregister-subprocess-events) -- 2.25.1