Skip to content

cl-SDL2 appears to block SLIME/swank updates in event loop #141

@fouric

Description

@fouric

The function swank::handle-requests appears to become non-functional in an SDL2 event loop. Example code:

(defun test ()
  (sdl2:with-init (:everything)
    (sdl2:with-window (window)
      (sdl2:with-renderer (renderer window :flags '(:presentvsync))
        (sdl2:with-event-loop (:method :poll)
          (:idle ()
                 (let ((connection (or swank::*emacs-connection* (swank::default-connection))))
                   (when connection
                     (swank::handle-requests connection t)))
                 (sdl2:set-render-draw-color renderer 0 0 0 255)
                 (sdl2:render-clear renderer)
                 (sdl2:render-present renderer))
          (:quit () t))))))

In the above code, the SLIME REPL does not update while the SDL2 event loop is running. When I run another loop in the same image that does not invoke the SDL2 event loop, the SLIME REPL updates successfully:

```lisp
(defun test-2 ()
  (dotimes (i 10)
    (sleep 1)
    (let ((connection (or swank::*emacs-connection* (swank::default-connection))))
      (when connection
        (swank::handle-requests connection t))))
  (princ "done"))

Environment:
`sbcl --version`: SBCL 2.0.1.debian
`uname -a`: Linux monolith 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
emacs `version`: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian
cl-sdl2 version: cl-sdl2-20201220-git

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions