[slime-devel] Running tasks when slime isn't connected

I'm writing an application that needs to continue to process data, even when slime is not connected. If I had threads, I might use them, but I'm using CLISP. My solution to this problem is to insert a loop that checks the status of the socket, and processes a chunk of data, until the socket is ready, before accepting the connection. I'd really like something like this committed, so I don't have to maintain my own version of slime forever, but I'm open to any other solutions as well. My changes follow. Thanks, Shaun ------------------------------------------------------------------------- swank-backend.lisp: (definterface connection-available-p (socket) "Returns t if (accept-connection socket) will proceed without blocking.") swank.lisp: (defvar *disconnected-idle-hook* '() "This hook is run repeatedly, whenever a client is not connected.") (defun serve-connection (socket style dont-close external-format) (loop until (or (null *disconnected-idle-hook*) (connection-available-p socket)) do (run-hook *disconnected-idle-hook*)) (let ((client (accept-authenticated-connection socket :external-format external-format))) (unless dont-close (close-socket socket)) (let ((connection (create-connection client style external-format))) (run-hook *new-connection-hook* connection) (push connection *connections*) (serve-requests connection)))) swank-clisp.lisp: (defimplementation connection-available-p (socket) (socket:socket-wait socket 0))
participants (1)
-
Shaun Morris