Changeset 13078


Ignore:
Timestamp:
Oct 22, 2009, 2:34:30 AM (10 years ago)
Author:
gb
Message:

CANCEL-TERMINATE-WHEN-UNREACHABLE: it seems that this can be much
simpler than it has been; notably, avoid the use of WITH-DEFERRED-GC,
since that may lead to missed suspend signals.

File:
1 edited

Legend:

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

    r13067 r13078  
    988988  (let* ((found nil))
    989989    (with-lock-grabbed (*termination-population-lock*)
    990       ;; Have to defer GCing, e.g., defer responding to a GC
    991       ;; suspend request here (that also defers interrupts)
    992       ;; We absolutely, positively can't take an exception
    993       ;; in here, so don't even bother to typecheck on
    994       ;; car/cdr etc.
    995       (with-deferred-gc
    996           (do ((spine (population-data *termination-population*) (cdr spine))
    997                (prev nil spine))
    998               ((null spine))
    999             (declare (optimize (speed 3) (safety 0)))
    1000             (let* ((head (car spine))
    1001                    (tail (cdr spine))
    1002                    (o (car head))
    1003                    (f (cdr head)))
     990      ;; We don't really need to be very paranoid here.  Nothing can
     991      ;; be added to the termination queue while we hold the lock,
     992      ;; and the GC can't splice anything out of the list while
     993      ;; we hold a strong reference to that list.
     994      (let* ((population *termination-population*)
     995             (queue (population.data population)))
     996        (do* ((prev nil spine)
     997              (spine queue (cdr spine)))
     998             ((null tail))
     999          (let* ((entry (car spine)))
     1000            (destructuring-bind (o . f) entry
    10041001              (when (and (eq o object)
    10051002                         (or (null function-p)
    10061003                             (eq function f)))
    10071004                (if prev
    1008                   (setf (cdr prev) tail)
    1009                   (setf (population-data *termination-population*) tail))
     1005                  (setf (cdr prev) (cdr spine))
     1006                  (setf (population.data population) (cdr spine)))
    10101007                (setq found t)
    10111008                (return)))))
    1012       found)))
     1009      found))))
    10131010
    10141011
Note: See TracChangeset for help on using the changeset viewer.