Changeset 5607


Ignore:
Timestamp:
Dec 14, 2006, 2:12:37 PM (18 years ago)
Author:
Gary Byers
Message:

THREAD-ENABLE: second arg is TERMINATION-SEMAPHORE.

KILL-LISP-THREAD: don't use #_pthread_cancel, which may force the target
thread to transition from running lisp code to running foreign code
without advertising that fact. Send a SIGQUIT instead, and trust the
SIGQUIT handler to manage that transition. Don't try to kill the
initial thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-lisp-threads.lisp

    r5484 r5607  
    402402        (cons function args)))
    403403
    404 (defun thread-enable (thread activation-semaphore allocation-quantum &optional (timeout most-positive-fixnum))
     404(defun thread-enable (thread termination-semaphore allocation-quantum &optional (timeout most-positive-fixnum))
    405405  (let* ((tcr (or (lisp-thread.tcr thread) (new-tcr-for-thread thread))))
    406406    (with-macptrs (s)
     
    410410         tcr
    411411         (lisp-thread.startup-function thread))
    412         (%activate-tcr tcr activation-semaphore allocation-quantum)
     412        (%activate-tcr tcr termination-semaphore allocation-quantum)
    413413        thread))))
    414414                             
     
    424424
    425425(defun kill-lisp-thread (thread)
    426   (let* ((pthread (lisp-thread-os-thread thread)))
    427     (when pthread
    428       (setf (lisp-thread.tcr thread) nil
    429             (lisp-thread.state thread) :exit)
    430       (#_pthread_cancel pthread))))
     426  (unless (eq thread initial-thread)
     427    (let* ((pthread (lisp-thread-os-thread thread)))
     428      (when pthread
     429        (setf (lisp-thread.tcr thread) nil
     430              (lisp-thread.state thread) :exit)
     431        (#_pthread_kill pthread #$SIGQUIT)))))
    431432
    432433;;; This returns the underlying pthread, whatever that is.
Note: See TracChangeset for help on using the changeset viewer.