On 12/30/05, Dmitri Hrapof <yavannadil@...> wrote:
> I did the following
> (when *slime-friendly*
> ((error (lambda (condition)
> (invoke-restart (find-restart 'remove-them
> (sb-bsd-sockets:socket-file-descriptor k)
> (lambda (fd)
> (declare (ignore fd))
> (loop while (op:work_pending *the-orb*)
> do (op:perform_work *the-orb*))))))
> and it brought no relief.
> Error was signalled, and backtrace was:
> 0: (SB-IMPL::HANDLER-DESCRIPTORS-ERROR)
> 1: (SB-IMPL::SUB-SERVE-EVENT NIL 0)
> 2: (SB-SYS:WAIT-UNTIL-FD-USABLE 0 :INPUT NIL)
> (op:perform_work) doesn't call SB-SYS:SERVE-EVENT...
> Is there any way to bind handlers for SB-IMPL::SUB-SERVE-EVENT?
> Or around REPL, so to say? Kind of "global" HANDLER-BIND?
Ah, right. I don't know of any /portable/ way to define a global
HANDLER-BIND for a particular condition as you suggest. In SBCL,
you'd have to hack src/code/toplevel.lisp. To work around this,
instead of working in the REPL directly, I usually have a global entry
point to the server, and have the global HANDLER-BIND be one of the
first few forms, something like this:
(defun server ()
(handler-bind (error ...)
SERVER-BODY manages the fd-handlers (ensuring no active fd-handler on
exit etc.) and calls SERVE-EVENT. Would this approach be
unsatisfactory? Do you need to work in the REPL? (When working in
the REPL directly, I find the fd conditions more reminder than