mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-30 04:10:44 -08:00
SERVE-EVENT now allows streams and sockets as arguments, instead of file descriptors.
This commit is contained in:
parent
cf315df2c6
commit
dacffdc468
2 changed files with 13 additions and 1 deletions
|
|
@ -56,11 +56,20 @@
|
|||
(define-c-constants
|
||||
+eintr+ "EINTR")
|
||||
|
||||
(defmethod ext::stream-fd ((stream t))
|
||||
(etypecase stream
|
||||
(fixnum stream)
|
||||
(two-way-stream (ext::stream-fd (two-way-stream-input-stream stream)))
|
||||
(file-stream (si:file-stream-fd stream))
|
||||
(otherwise (error "In SERVE-EVENT, stream~% ~A~%does not have an associated file descriptor" stream))))
|
||||
|
||||
(defstruct (handler
|
||||
(:constructor make-handler (direction descriptor function))
|
||||
(:constructor make-handler (direction stream-or-descriptor function
|
||||
&aux (descriptor (ext::stream-fd stream-or-descriptor))))
|
||||
(:copier nil))
|
||||
;; Reading or writing...
|
||||
(direction nil :type (member :input :output))
|
||||
(stream-or-descriptor nil)
|
||||
;; File descriptor this handler is tied to.
|
||||
;; FIXME: Should be based on FD_SETSIZE
|
||||
(descriptor 0)
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,9 @@ also known as unix-domain sockets."))
|
|||
(sb-ext:cancel-finalization socket))
|
||||
stream))
|
||||
|
||||
(defmethod ext::stream-fd ((socket socket))
|
||||
(socket-file-descriptor socket))
|
||||
|
||||
#+:wsock
|
||||
(defmethod socket-make-stream ((socket named-pipe-socket)
|
||||
&key input output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue