X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=eightsync%2Fagenda.scm;h=adbd0c688f402def34b35cf01ef7db7ace697cee;hb=1ff1b8f96db972ad48e877111814cce45c829e37;hp=e4cb1dfd1ca9ced0e90387e71f7f1d3e24facfef;hpb=1976e7ad0d5dd32df68c3beff72520bb99813ecc;p=8sync.git diff --git a/eightsync/agenda.scm b/eightsync/agenda.scm index e4cb1df..adbd0c6 100644 --- a/eightsync/agenda.scm +++ b/eightsync/agenda.scm @@ -150,6 +150,9 @@ Generally done automatically for the user through (make-agenda)." (time time-segment-time) (queue time-segment-queue)) +;; @@: This seems to be the same as srfi-18's seconds->time procedure? +;; Maybe double check and switch to that? (Thanks amz3!) + (define (time-from-float-or-fraction time) "Produce a (sec . usec) pair from TIME, a float or fraction" (let* ((mixed-whole (floor time)) @@ -245,13 +248,13 @@ Will produce (0 . 0) instead of a negative number, if needed." "Subtract TIME2 from TIME1" (time-carry-correct (cons (- (car time1) (car time2)) - (- (cdr time2) (cdr time2))))) + (- (cdr time1) (cdr time2))))) (define (time-plus time1 time2) "Add TIME1 and TIME2" (time-carry-correct (cons (+ (car time1) (car time2)) - (+ (cdr time2) (cdr time2))))) + (+ (cdr time1) (cdr time2))))) (define-record-type @@ -551,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 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)