From 5686386b450ecf87beeea737b0d1a44818d37e4a Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 22 Nov 2015 20:13:07 -0600 Subject: [PATCH] Don't freak out on interrupts during (select)! make-coop-server-handler makes use of interrupts, so we need this code so as to not barf while connecting to 8sync while it's doing a (select) --- eightsync/agenda.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/eightsync/agenda.scm b/eightsync/agenda.scm index 2b46324..b26d93b 100644 --- a/eightsync/agenda.scm +++ b/eightsync/agenda.scm @@ -554,10 +554,17 @@ return the wrong thing via (8sync) and trip themselves up." ;; TODO: support usecond wait time too (match (get-wait-time) ((sec . usec) - (select (hash-keys (agenda-read-port-map agenda)) - (hash-keys (agenda-write-port-map agenda)) - (hash-keys (agenda-except-port-map agenda)) - sec usec)))) + (catch 'system-error + (lambda () + (select (hash-keys (agenda-read-port-map agenda)) + (hash-keys (agenda-write-port-map agenda)) + (hash-keys (agenda-except-port-map agenda)) + sec usec)) + (lambda (key . rest-args) + (match (pk 'rest-args rest-args) + ((_ _ _ (EINTR)) + '(() () ())) + (_ (error "Unhandled error in select!" key rest-args)))))))) (define (get-procs-to-run) (define (ports->procs ports port-map) (lambda (initial-procs) -- 2.31.1