Ticket #86: thread-restarts.patch

File thread-restarts.patch, 2.6 KB (added by ehuelsmann, 14 years ago)

Proposed patch

  • src/org/armedbear/lisp/autoloads.lisp

     
    318318
    319319(in-package "THREADS")
    320320
     321(autoload '(;; MAKE-THREAD helper
     322            thread-function-wrapper
    321323
    322 (autoload '(;; Mailbox
     324            ;; Mailbox
    323325            make-mailbox mailbox-send mailbox-empty-p
    324326            mailbox-read mailbox-peek
    325327
  • src/org/armedbear/lisp/debug.lisp

     
    9494                         (stream-offset *load-stream*)))
    9595        (simple-format *debug-io*
    9696                       (if (fboundp 'tpl::repl)
    97                            "Debugger invoked on condition of type ~A:~%"
    98                            "Unhandled condition of type ~A:~%")
     97                           "~S: Debugger invoked on condition of type ~A~%"
     98                           "~S: Unhandled condition of type ~A:~%")
     99                       (threads:current-thread)
    99100                       (type-of condition))
    100101        (simple-format *debug-io* "  ~A~%" condition)))))
    101102
  • src/org/armedbear/lisp/LispThread.java

     
    7272    public LispObject[] _values;
    7373    private boolean threadInterrupted;
    7474    private LispObject pending = NIL;
     75    private Symbol wrapper =
     76        PACKAGE_THREADS.intern("THREAD-FUNCTION-WRAPPER");
    7577
    7678    LispThread(Thread javaThread)
    7779    {
     
    8587            public void run()
    8688            {
    8789                try {
    88                     funcall(fun, new LispObject[0], LispThread.this);
     90                    funcall(wrapper,
     91                            new LispObject[] { fun },
     92                            LispThread.this);
    8993                }
    9094                catch (ThreadDestroyed ignored) {
    9195                      // Might happen.
  • src/org/armedbear/lisp/threads.lisp

     
    3434
    3535
    3636;;
     37;; MAKE-THREAD helper to establish restarts
     38;;
     39
     40(defun thread-function-wrapper (fun)
     41  (restart-case
     42      (funcall fun)
     43    (abort () :report "Abort thread.")))
     44
     45;;
    3746;; Mailbox implementation
    3847;;
    3948