mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-05 18:30:24 -08:00
Only call handlers established in the current thread and use atomic operations to update *descriptor-handlers*. Closes #588. Additionally: - improve the test code - add a test for the leak - provide internet machine link for the tutorial
23 lines
756 B
Common Lisp
23 lines
756 B
Common Lisp
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Test Example
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(require 'serve-event)
|
|
|
|
(defun test-stdin (&aux exit)
|
|
(format t "DOING STDIN. Type Q to exit.~%")
|
|
(serve-event:with-fd-handler
|
|
(0 :input #'(lambda (fd)
|
|
(declare (ignore fd))
|
|
(let ((ch (read-char)))
|
|
(format t "Got data ~s~%" ch)
|
|
(when (char= ch #\Q)
|
|
(setf exit t)))))
|
|
(loop until exit
|
|
do (format t "Entering serve-all-events...~%")
|
|
(force-output)
|
|
(serve-event:serve-all-events 5)
|
|
(format t "Events served~%"))))
|
|
|
|
(test-stdin)
|