Commits

Richo Healey committed f90a084

Simplify thread magic

  • Participants
  • Parent commits e05ab7a

Comments (0)

Files changed (1)

       #f
       ))
 
-(define handle
+(define real-handle
   (lambda (in out)
     ; We're lazy- we can find out everything about the request that we care
     ; about from it's first line
       )
   ))
 
-
+(define handle
+  (if threaded?
+    real-handle
+    (lambda (in out) (thread-start! (make-thread (lambda () (real-handle in out)))))))
 
 (define main
   (lambda (argv)
     (letrec ((sock (tcp-listen (string->number (get-environment-variable "PORT"))))
       (mainloop (lambda ()
         (let-values (((s-in s-out) (tcp-accept sock)))
-          (if threaded?
-            (thread-start! (make-thread (lambda () (handle s-in s-out))))
-            (handle s-in s-out)
-            )
+          (handle s-in s-out)
           (mainloop)
           ))))
       (mainloop))))