From: Christopher Allan Webber Date: Mon, 23 Nov 2015 02:13:07 +0000 (-0600) Subject: Don't freak out on interrupts during (select)! X-Git-Tag: v0.1.0~93 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=5686386b450ecf87beeea737b0d1a44818d37e4a;p=8sync.git 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) --- 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)