diff --git a/thot-simple.lisp b/thot-simple.lisp
index 0b938f7..b7a1c15 100644
--- a/thot-simple.lisp
+++ b/thot-simple.lisp
@@ -1,16 +1,21 @@
(in-package :thot)
-(defun acceptor-loop-simple (fd)
+(defun acceptor-loop-simple (fd &optional pipe)
(declare (type (unsigned-byte 31) fd))
- (labels ((acceptor-loop-simple-fun ()
- (loop
- (when *stop*
- (return))
- (ignore-errors
- (unistd:with-selected (`(,fd) () () 1)
+ (let ((readfds))
+ (push fd readfds)
+ (when pipe
+ (push pipe readfds))
+ (labels ((acceptor-loop-simple-fun ()
+ (loop
+ (when *stop*
+ (return))
+ (unistd:with-selected (readfds () () 100)
(readable writable errors)
- (when readable
+ (when (and pipe (find pipe readable))
+ (return))
+ (when (find fd readable)
(socket:with-accept (clientfd) fd
(with-stream (stream (babel-io-stream
(fd-io-stream clientfd)))