Commit 52cca185b0e707cee7ed65f9b73af1fbd2cfd802

Thomas de Grivel 2017-06-26T12:30:26

Rename thot-single -> thot-simple.

diff --git a/thot-simple.lisp b/thot-simple.lisp
new file mode 100644
index 0000000..0b938f7
--- /dev/null
+++ b/thot-simple.lisp
@@ -0,0 +1,23 @@
+
+(in-package :thot)
+
+(defun acceptor-loop-simple (fd)
+  (declare (type (unsigned-byte 31) fd))
+  (labels ((acceptor-loop-simple-fun ()
+             (loop
+                (when *stop*
+                  (return))
+                (ignore-errors
+                  (unistd:with-selected (`(,fd) () () 1)
+                      (readable writable errors)
+                    (when readable
+                      (socket:with-accept (clientfd) fd
+                        (with-stream (stream (babel-io-stream
+                                              (fd-io-stream clientfd)))
+                          (request-loop stream)))))))))
+    #'acceptor-loop-simple-fun))
+
+(setq *acceptor-loop* 'acceptor-loop-simple)
+
+;(untrace acceptor-loop request-loop read write cffi-socket:accept unistd:close)
+
diff --git a/thot-single.lisp b/thot-single.lisp
deleted file mode 100644
index 3de9889..0000000
--- a/thot-single.lisp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-(in-package :thot)
-
-(defun acceptor-loop (fd)
-  (declare (type (unsigned-byte 31) fd))
-  (loop
-     (when *stop*
-       (return))
-     (cffi-socket:with-accept (clientfd) fd
-       (with-stream (stream (babel-io-stream (fd-io-stream clientfd)))
-         (request-loop stream)))))
-
-(setq *acceptor-loop* 'acceptor-loop)
-
-;(untrace acceptor-loop request-loop read write cffi-socket:accept unistd:close)
-
diff --git a/thot.asd b/thot.asd
index 9744933..74cfc99 100644
--- a/thot.asd
+++ b/thot.asd
@@ -20,5 +20,5 @@
   :components
   ((:file "package")
    (:file "thot" :depends-on ("package"))
-   (:file "thot-single" :depends-on ("thot"))
-   (:file "thot-threaded" :depends-on ("thot-single"))))
+   (:file "thot-simple" :depends-on ("thot"))
+   (:file "thot-threaded" :depends-on ("thot-simple"))))