From 33d3e0390b074f6b49cd55ea1888faf3c9ebec68 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:38:50 +0000 Subject: [PATCH] Convert multi-LETREC to internal definitions in thread.scm. --- src/runtime/thread.scm | 46 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/runtime/thread.scm b/src/runtime/thread.scm index a03d5639a..d030a2925 100644 --- a/src/runtime/thread.scm +++ b/src/runtime/thread.scm @@ -674,30 +674,28 @@ USA. (define (permanently-register-io-thread-event descriptor mode thread event) (let ((stop? #f) (registration #f)) - (letrec ((handler - (named-lambda (permanent-io-event mode*) - (if (not stop?) - (event mode*)) - (if (not (or stop? (memq mode* '(error hangup #f)))) - (register)))) - (register - (lambda () - (deregister) - (if (not stop?) - (set! registration - (register-io-thread-event descriptor mode - thread handler))))) - (deregister - (lambda () - (if registration - (begin - (deregister-io-thread-event registration) - (set! registration #f)))))) - (register) - (cons 'deregister-permanent-io-event - (lambda () - (set! stop? #t) - (deregister)))))) + (define handler + (named-lambda (permanent-io-event mode*) + (if (not stop?) + (event mode*)) + (if (not (or stop? (memq mode* '(error hangup #f)))) + (register)))) + (define (register) + (deregister) + (if (not stop?) + (set! registration + (register-io-thread-event descriptor mode + thread handler)))) + (define (deregister) + (if registration + (begin + (deregister-io-thread-event registration) + (set! registration #f)))) + (register) + (cons 'deregister-permanent-io-event + (lambda () + (set! stop? #t) + (deregister))))) (define (register-io-thread-event descriptor mode thread event) (guarantee-select-mode mode 'register-io-thread-event) -- 2.25.1